(Intro to Java) Avoid using breaks in loops or statments. Ice Cream Truck In this program, you will write a menu program for an ice cream truck. Name your program IceCream.java For this program, you will need to write 3 methods, as follows: dispayTotal Takes a double parameter for the total food price. Takes another double parameter for the percent tip calls the calculateTax method to add taxes to the price. calls the calculateTip method to add the tip to the price. Displays the price to two decimal places along with the message "With taxes and tip, your total comes to $" returns nothing Note that you will need to watch the 16 videos before you can complete this method calculateTax Takes in a double parameter for the subtotal for the food. Calculates the tax, assuming the tax rate is 9.25% in San Jose adds the tax onto the the total price, returns the update price calculateTip Takes in a double parameter for the current bill (price of food + tax). Takes in a second double parameter for the percent tip Calculates the tip and adds the tip onto the the total price returns the updated price Additional Specifications Each method must also have a full Javadoc comment in the style described in class or you will lose 3 points. Important: You should call the displayTotal method inside of main, not the other two methods. The other 2 methods should be called inside of the displayTotal method. Hint: calculateTip will work very similarly to the calculateTax method Note: If the user does not select option A, B, or C for the tip, you should automatically assign a tip of 20% (as shown in the second sample output below). Starter Code: /**  * @author FILL IN YOUR NAME HERE  * @author FILL IN YOUR NAME HERE  * CIS 36A  */ import java.util.Scanner; public class IceCream {     public static void main(String[] args) {         Scanner input = new Scanner(System.in);                 int numChoc;         int numVan;         int numStraw;                 final double PRICE_CHOC = 3.50;         final double PRICE_VAN = 3.25;         final double PRICE_STRAW = 3.15;         final double SUBTOTAL, TIP;                 String choice;                 System.out.println("Jingle Jingle! Place Your Order Here!\n");         System.out.print("Enter the number of chocolate: ");         numChoc = input.nextInt();                 System.out.print("Enter the number of vanilla: ");         numVan = input.nextInt();                 System.out.print("Enter the number of strawberry: ");         numStraw = input.nextInt();                 //Add more code here!           System.out.println("Thank you! Please come again!");     }         //Write your methods AND JAVADOC COMMENTS here } Sample Output Your program should work identically to the following: Jingle Jingle! Place Your Order Here! Enter the number of chocolate: 4 Enter the number of vanilla: 3 Enter the number of strawberry: 2 Would you like to tip: A: 10% B: 15% C: 20% Enter your choice: B You chose 15% With taxes and tip, your total comes to $37.75 Thank you! Please come again! Alternately: Jingle Jingle! Place Your Order Here! Enter the number of chocolate: 1 Enter the number of vanilla: 0 Enter the number of strawberry: 5 Would you like to tip: A: 10% B: 15% C: 20% Enter your choice: Z You chose 20% With taxes and tip, your total comes to $25.24 Thank you! Please come again! When your program works as shown above, submit

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Modularization Techniques
Section: Chapter Questions
Problem 13RQ
icon
Related questions
Question

(Intro to Java)

Avoid using breaks in loops or statments.

Ice Cream Truck
  • In this program, you will write a menu program for an ice cream truck.
  • Name your program IceCream.java
  • For this program, you will need to write 3 methods, as follows:

dispayTotal
  • Takes a double parameter for the total food price.
  • Takes another double parameter for the percent tip
  • calls the calculateTax method to add taxes to the price.
  • calls the calculateTip method to add the tip to the price.
  • Displays the price to two decimal places along with the message "With taxes and tip, your total comes to $<price>"
  • returns nothing
  • Note that you will need to watch the 16 videos before you can complete this method

calculateTax

  • Takes in a double parameter for the subtotal for the food.
  • Calculates the tax, assuming the tax rate is 9.25% in San Jose
  • adds the tax onto the the total price,
  • returns the update price

calculateTip

  • Takes in a double parameter for the current bill (price of food + tax).
  • Takes in a second double parameter for the percent tip
  • Calculates the tip and adds the tip onto the the total price
  • returns the updated price

Additional Specifications

  1. Each method must also have a full Javadoc comment in the style described in class or you will lose 3 points.
  2. Important: You should call the displayTotal method inside of main, not the other two methods.
  3. The other 2 methods should be called inside of the displayTotal method.
  4. Hint: calculateTip will work very similarly to the calculateTax method
  5. Note: If the user does not select option A, B, or C for the tip, you should automatically assign a tip of 20% (as shown in the second sample output below).
Starter Code:
/**
 * @author FILL IN YOUR NAME HERE
 * @author FILL IN YOUR NAME HERE
 * CIS 36A
 */
import java.util.Scanner;
public class IceCream {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
       
        int numChoc;
        int numVan;
        int numStraw;
       
        final double PRICE_CHOC = 3.50;
        final double PRICE_VAN = 3.25;
        final double PRICE_STRAW = 3.15;
        final double SUBTOTAL, TIP;
       
        String choice;
       
        System.out.println("Jingle Jingle! Place Your Order Here!\n");
        System.out.print("Enter the number of chocolate: ");
        numChoc = input.nextInt();
       
        System.out.print("Enter the number of vanilla: ");
        numVan = input.nextInt();
       
        System.out.print("Enter the number of strawberry: ");
        numStraw = input.nextInt();
       
        //Add more code here!
 
        System.out.println("Thank you! Please come again!");
    }
   
    //Write your methods AND JAVADOC COMMENTS here
}
Sample Output
  • Your program should work identically to the following:
Jingle Jingle! Place Your Order Here!

Enter the number of chocolate: 4
Enter the number of vanilla: 3
Enter the number of strawberry: 2

Would you like to tip:

A: 10%
B: 15%
C: 20%

Enter your choice: B
You chose 15%

With taxes and tip, your total comes to $37.75

Thank you! Please come again!


  • Alternately:
Jingle Jingle! Place Your Order Here!

Enter the number of chocolate: 1
Enter the number of vanilla: 0
Enter the number of strawberry: 5

Would you like to tip:

A: 10%
B: 15%
C: 20%

Enter your choice: Z
You chose 20%

With taxes and tip, your total comes to $25.24

Thank you! Please come again!
  • When your program works as shown above, submit 
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage