Using String Methods Create a new class with a main method called StringExperiment.java Remember to include required comment blocks Declare three String variables called: firstName, middleName, and lastName Initialize each with your names Do each of the following: Print your full name with a space between each name. First Middle Last Print your first name, middle initial followed by a period, and last name. First M. Last Print your first name in all uppercase letters and last name in all lowercase letters. FIRST last Print the length of your last name. Be sure to give it a label. Length of last name = 4 Calculate the middle position in your last name and print the letter that is there. If your name has an even number of letters, it will be one to the right of the middle. s Print the last letter in your first name. t Compile, debug, and run. Arithmetic Create a new Java class named RestaurantBillCalculator. Complete the comment blocks as required for every program. Add an appropriate description in the Javadoc class comment. Declare all the variables at the top of the main method. Use descriptive variable names. Declare the following: a double constant for tip percentage set to 15%. Hint: Review the rules for naming constants. a double constant for tax rate set to 7.5% a double variable to hold the meal cost. Set the value to $45.75. three double variables to hold the tax, tip amount, and total amount. Initialize each to zero. Write Java statements to calculate the following: tax by multiplying meal cost by tax rate tip amount by multiplying meal cost by tip percentage total bill amount which is the combination of meal cost, tax, and tip amount Display the information in the following format: (Note: Dont worry about trying to format to two decimal places yet. You will learn how to do that soon.) Meal Cost: $45.75 Tax: $3.43125 Tip: $6.8625 Total amount: $56.043749999999996
Uncategorized
[Solved] SOLVED:RestaurantBillCalculator and StringExperiment java programs
$25
File Name: SOLVED:RestaurantBillCalculator_and_StringExperiment_java_programs.zip
File Size: 621.72 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.