QuestionQuestion

Overview
This program will consist of a sequence of reading information from the standard input, storing that information in appropriate variables, computing values, and displaying those values to the user with informative text. Complete the following steps in order, using the sample output below to know exactly what to print and what text to include. Do not deviate from the format of the sample output or you will fail the automated test cases. Your code must work for any valid total, tip amount, and number of people. Negative or malformed input will not be supplied by the testing program. Output that does not match the sample output may result in failing test cases, even if the logic of the program is correct.
1. Request the total bill amount and store it in a variable of type double
2. Compute and display possible tip amounts for 15%, 18%, and 20% of the given total
3. Request and read in a tip amount (in dollars and cents, not in percentage)
4. Request and read in the number of ways to split the bill (as an int variable type)
5. Display the total plus the tip amount
6. Display the cost per person split in the number of ways entered in step 4

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.Scanner;

/*
* Class to calculate bill
*/
public class BillCalculator {
   
    // main method containing program execution code
    public static void main(String[] args) {
       // Create Scanner to read user input via console
       Scanner s = new Scanner(System.in);
       // Query the user for total bill amount
       System.out.print("Please enter the total bill amount: ");
       double bill = s.nextDouble();
       // Calculate and print bill percentages
       System.out.println("15% is $" + 0.15*bill...

By purchasing this solution you'll be able to access the following files:
Solution.PNG and Solution.java.

$40.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats