Question: Please use Java Problem 4: Tips class (Tips.java) Description: Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and
Problem 4: Tips class (Tips.java) Description: Write a program that reads the subtotal and the gratuity rate, then 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. Please format your output so that the output floating-point number is of scale of 2 (with 2 digits after the decimal point). Outputs: $ java Tips Please enter the subtotal and a gratuity rate: 10 15 The gratuity if $1.50 and total is $11.50 Problem 5: Distance class (Distance.java) Description: Write a program that prompts the user to enter two points (x1, y1) and (x2, y2) and displays their distance between them. The formula for computing the distance is: distance = (x - x)* +0%, - y.) Please format your output so that the output floating-point number is of scale of 2 (with 2 digits after the decimal point). Outputs: $ java Distance Please enter xl and yi: 1.5 -3.4 Please enter x2 and y2: 4 5 The distance between these two points is: 8.76
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
