You have been hired to write an application by your employer, Crying Four Year O
ID: 674961 • Letter: Y
Question
You have been hired to write an application by your employer, Crying Four Year Olds Inc. Your company produces a miracle elixir that when given to a crying four year old (let’s say if his name is Brendan…), he will immediately turn his day around with a smile.Your product comes in two varieties – Fruit Punch Smile & Pucker Face Nap. Your application must ask the user for their name, address, and the flavor desired, and the number of cases. The product is $29.99 a case. Print an invoice showing the flavor, quantity, & price. Assume a 7.25% sales tax.
Explanation / Answer
//Prompt a user to enter a series of integers separated by spaces
//and accept the input as a String. Display the list of integers
//and their sum. Save the file as SumIntegersInString.java.
import java.io.*;
import java.util.Scanner;
class Invoice{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
System.out.println("Enter name:");
String name = in.nextLine();
System.out.println("Enter address:");
String address = in.nextLine();
System.out.println("Enter flavor:");
String flavor = in.nextLine();
System.out.println("Enter number of cases:");
int cases = in.nextInt();
double amount = cases*29.99;
amount += 0.0725*amount;
System.out.println("Flavor:" + flavor);
System.out.println("Quantity:" + cases);
System.out.println("Price:" + amount);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.