Question: Purpose: The purpase of this exercise is to become familiar with Java basic syntax, structure and problem solving. In addition, you should learn how to

Purpose: The purpase of this exercise is to become familiar with Java basic syntax, structure and problem solving. In addition, you should learn how to submit a program using the file submit capability of Blackboard Exercise: Write a Java program that calculates the cast of gas for a road trip. Your program will need to collect the fallowing pieces of information from the user. First name Miles per gallon (mpg) of the car Number of miles planned to drive Current price per gallon of gas After collecting the user's information and the performing the calculations your program shauld display the results in a format Please enter your First Name: Ralph Please enter the MPG of your car: 20 Please enter the miles to be traveled: 160 What is the price per gallon of gas 2.00 Hello, Ralph! Thank you for providing your information! Car MPG: 20 Miles to Drive: 160 Price per gallon of gas: $2.00 Your trip will cost: $1600 Program file suggestions: Call your application Calculate Trip.java Call your output file HW3 output.txt Part II Purpose: To become familiar with Java language basics (variable declaration, numeric expression, assignment statement, input using Scanner, and formatting output). Problem Description: Write a program to accept inputs from a user including yourname shares (only whole shares allowed) purchases of some stock (for example the Microsoft stack symbol is MSFT) at the price of per share and paid the stackbraker $15 Two weeks later, the person sold the shares at per share and paid another $10 for the Create the necessary input, process and output variables, choosing appropriate data types, and write a Java program to accept input, calculate and display and display the following: dollar amount paid for the shares dollar amount of the shares sold total transaction fee paid to the braker (including both buy and sell) - Use constants/final amount of profit (ar loss) made after selling the shares
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
