Please use Java and only Java.
You have been hired by your favorite restaurant to create a food nutrition app for their customers to use. Before you get too far, the owner wants you to create a quick prototype. Your app should output a food name and the number of calories, then ask the customer how many they want. You need to ask them for 3 menu items. Once they tell you the quantity for the three menu items, you will output the meal’s total calories. Behind the scenes, you are going to create a Food class. Your Food class should use name and calories in the constructor (in that order!). You should create getters and setters for these variables. You also need a toString method that will be used in the line before you ask for the quantity. In addition to the Food class, you will have a FoodRunner class where you will have your main method. In here, you will create your three foods and ask for the quantities. After that, you can use the quantities to calculate and output the total. Sample output: Hamburgers have 600 calories. How many would you like? 2 French Fries have 350 calories. How many would you like? 1 Coke have 200 calories. How many would you like? 2 Your meal will have a total of 1950 calories
check out the solution and do comment if any queries.
------------------------------------------------------------------------------------------
import java.util.*; // imported for scanner class to get user input
// Food class
class Food {
// attributes
String name;
int calories;
// default constructor
Food() {
name = "";
calories = 0;
}
// setters
void setName(String n) {
this.name = n;
}
void setCalories(int cal) {
this.calories = cal;
}
// getters
String getName() {
return this.name;
}
int getCalories() {
return this.calories;
}
// toString method returns food name and calories
public String toString() {
return "\n" + this.name + " have " + this.calories + "
calories.";
}
}
public class FoodRunner {
public static void main(String args[]) {
// Scanner class object instantiation
Scanner input = new Scanner(System.in);
// instantiation of 3 Food class objects
Food food1 = new Food();
Food food2 = new Food();
Food food3 = new Food();
// set food names and their respective calories using setters
methods
food1.setName("Hamburgers");
food1.setCalories(600);
food2.setName("French Fries");
food2.setCalories(350);
food3.setName("Coke");
food3.setCalories(200);
// print food 1 details using toString method
System.out.println(food1);
// ask user for quantity
System.out.print("How many would you like? ");
// get user input
int q1 = input.nextInt();
// similarly for food 2 and 3
System.out.println(food2);
System.out.print("How many would you like? ");
int q2 = input.nextInt();
System.out.println(food3);
System.out.print("How many would you like? ");
int q3 = input.nextInt();
// find the total meals calorie
int total;
// get the calories of respective foods using getters and multiply
them with quantity
// sum up all results to get the total meals calories
total = (q1 * food1.getCalories()) + (q2 * food2.getCalories()) +
(q3 * food3.getCalories());
// display the result
System.out.println("\nYour meal will have a total of " + total + "
calories.");
}
}
-----------------------------------------------------------------------
Code :

--------------------------------------------------
Output ::

Please use Java and only Java. You have been hired by your favorite restaurant to create...
Your assignment is to create a restaurant ordering system where
the cashier can create the menu and then take in the order and
display the order back to the customer
Sample Execution – Level 1
Welcome to your Menu Creation system.
How many items would you like to have on your menu? 2
Create your menu!
Enter item #1: Coffee
Enter item #2: Tea
This is the menu:
Coffee
Tea
What would you like to order? Cake
That isn’t on...
7.2 Write a Java program called to create an Excel spreadsheet Create a class called Food to represent a Lunch food item. Fields include name, calories, carbs In a main method (of a different class), ask the user "How many things are you going to eat for lunch?". Loop through each food item and prompt the user to enter the name, calories, and grams of carbs for that food item. Create a Food object with this data, and store each...
in java : Create Java Application you are to create a project using our designated IDE (which you must download to your laptop). Create the code to fulfill the requirements below. Demonstrate as stipulated below. Create a Main Application Class called AddressBookApplication (a counsole application / command line application). It should Contain a Class called Menu that contains the following methods which print out to standard output a corresponding prompt asking for related information which will be used to update...
eclipse java Oxygen
Design a self-service fast food menu. Name your class FastFood. Create a test class based on the examples from chapter 4. Create a program to do the following. When you set up the program, save the java file to a folder named Chapter 04 Program. Console Welcome to the fast food order menu How may I help you Please place your order: НННН Please place your order Your order Your subtotal: $e.00 $e.00 Continue? (y/n): Y Please...
Using Java
In this assignment we are working with arrays. You have to ask the user to enter the size of the integer array to be declared and then initialize this array randomly. Then use a menu to select from the following Modify the elements of the array. At any point in the program, if you select this option you are modifying the elements of the array randomly. Print the items in the array, one to a line with their...
Write a java application that should have a menu system along the following lines (you can have sub-menus if you deem that to be necessary) 1) Ask the user how many books their application should store • The application then creates a suitable storage component for the books (i.e. an array of Book objects) 2) Add book details • You as the reader can add details of a book here (i.e. a Book object’s properties are given values). 3) Display...
Language : JAVA Part A Create a class CompanyDoc, representing an official document used by a company. Give it a String title and an int length. Throughout the class, use the this. notation rather than bare instance variables and method calls. Add a default constructor. Add a parameterized constructor that takes a value for title. Use this( appropriately to call one constructor from another. Add a toString(), which returns a string with the title, and the length in parentheses. So...
Sample Execution – Level 3
Welcome to your Menu Creation system.
How many items would you like to have on your menu? 2
Create your menu!
Enter item #1: Coffee
Enter the number of toppings: 2
Enter topping #1: Whipped Cream
Enter topping #2: Cinnamon
Enter item #2: Tea
Enter the number of toppings: 2
Enter topping #1: Milk
Enter topping #2: Sugar
May I take your order?
This is the menu:
Coffee
Tea
Pop
How many items would you...
CSC 143 Weekly Exercise: Satisfying Slurps For this assignment, imagine you have been hired to create a program to manage drink orders at a local coffee shop. The coffee shop is known for changing their menu frequently, and people come to the shop in anticipation of getting unusual, but delicious, drinks. Since the drinks change so frequently, your program will need to have the flexibility to handle this. Accordingly, you decide to create classes that can be used to price...
Java Create a program for a car dealer to use where you have a class for Salesman, Cars, and the Records of sale. 4 salesman and 4 cars to start with but have array size for 50 cars, have space for 100 records in array. The program should have 6 options in the menu. buy car, sell car, show inventory, show salesman, show sales records, and exit. Salesman class - Name, ID number, Commision rate, Total commisions earned, Totals number...