Question
**Java Languge** 3- A cars miles-per-gallon (MPG) can be calculated with the following formula: MPG = Miles driven / Gallons of gas used Write a
**Java Languge**
3- A cars miles-per-gallon (MPG) can be calculated with the following formula:
MPG = Miles driven / Gallons of gas used
Write a program that asks the user for the number of miles driven and the gallons of gas used. It should calculate the cars miles-per-gallon and display the result on the screen.
4- Write a program that computes the tax and tip on a restaurant bill. The program should ask the user to enter the charge for the meal. The tax should be 6.75 percent of the meal charge. The tip should be 20 percent of the total after adding the tax. Display the meal charge, tax amount, tip amount, and total bill on the screen.
5- Write a program that asks the user to enter the name of his or her favorite city. Use a String variable to store the input. The program should display the following:
The number of characters in the city name
The name of the city in all uppercase letters
The name of the city in all lowercase letters
The first character in the name of the city
Submission guides:
- Submit your code as a .java or .txt file for each question.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started