Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Write a program that reads the subtotal and the gratuity rate, and computes the gratuity and total

Computer Science May 23, 2021

Write a program that reads the subtotal and the gratuity rate, and computes the gratuity and total. For example, if the user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5 as gratuity and $11.5 as total.

Expert Solution

Answer:

public class Exercise2_5 {

public static void main(String args[]) {

// Read subtotal

java.util.Scanner input = new java.util.Scanner(System.in); System.out.print("Enter subtotal: ");

double subtotal = input.nextDouble();

// Read subtotal

System.out.print("Enter gratuity rate: "); double rate = input.nextDouble();

double gratuity = subtotal * rate / 100; double total = subtotal + gratuity;

System.out.println("Gratuity is " + gratuity); System.out.println("Total is " + total);

}

}

Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment