Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please can you explain what you mean by raw code? ulator- starter - MaxRangeCalculator java * [P] C:Userschris(OneDrive DocumentsAVA Proj1 Max Range Calculator starter (1)

image text in transcribed

image text in transcribed

image text in transcribed

please can you explain what you mean by raw code?

image text in transcribed

ulator- starter - MaxRangeCalculator java * [P] C:\Users\chris(OneDrive Documents\AVA Proj1 Max Range Calculator starter (1) GRASP CSD (Java) et Settings Tools Window Help EDITUM me 1 import java.util.Scanner; 3/* Project 1: Max Range Calculator. er.gp 5 This program calculates the maximum range of a vehicle given the miles per gallon and the amount of fuel in gallons 6 Note that all values are integers in this program. 7 * The program asks for two integer inputs from a user: the miles per gallon and number of gallons. 8 * It does a simple calculation to find the maximum range. 9* It then reports the users inputs as well as the maximum range. le * Your tasks are designated by "TODO" in the code below. There are two TODOS 12 * in the code below. 15 public class MaxRangeCalculator public static void main(String[] args) { // The Scanner object is used to get input from the user. Scanner scnr = new Scanner(System.in); // Declaring and initializing variables used in the program. int milesPerGallon = 0; int gallons = 0; int maxRange = 0; 9 MaxRangeCalculator.java Compile Messages JGRASP Messages Run 1/0 Interactions cings Tools Window Help // Print a welcome message to user. System.out.println("Welcome to the MPG Calculator. "); // Prompting the user for each input value and capturing their input. System.out.println("Enter the miles per gallon (MPG): "); milesPerGallon = scnr.nextInt(); System.out.println("Enter the number of gallons: "); gallons = scnr.nextInt(); /* TODO: Write code that calculates the max range given the miles per gallon and the number of gallons input by the user. You replace the 999 on the right hand side with your calculation. This calculation is the product of milesPerGallon and gallons. Assign this product to the maxRange variable. You must use the two variables milesPerGallon and gallons in the calculation. maxRange = 999; System.out.print("You entered " + milesPerGallon + " MPG"); System.out.println("and " + gallons + " gallons."); System.out.println("Your maximum range is " + maxRange + " miles."); /* TODO: Write a print statement that prints this exact message: se the following table to test your maxRange calculation. Miles per gallon Gallons Expected max range 25 175 40 280 eas (Laval 27 sentin per KRASP CSD Plan led se82an elor InputStreame n on umentsUAVA Projt Max Range Calator starter ndow Help 2002 2003 2002 2004 Dec 2005 Beie java/lang/object 2001 2006 2001 2008 eee 2006 init) 0001 02 ) 2007 ecc 80E ee eele java/lang/Syster ere: 22 in 2001 2015 Ljava/fo/InputStream eee eeie eeeceees 11 000 0918 (Ljava/lo/InputStreas: 2013 00C 6014 2015 201 3 out wei e35 Ljava/io/PrintStream; bene 0917 01 001F welcome to the calculator Bela eeeeeeeeeee1c 010 0801 2013 java/io/PrintStrean eet 1007 println el eens (Ljava/lang/String: eee eeee eee eee nextInt eaei eres OT 208 01 0910 Enter the rumber of allons: 22 9 0019 Beec e Bea1ee5 print 12eeei 12 2. cae e al 2012 Max RangeCalculator 2004 Code et 10 SourceFile eeei 2017 MaxRangeCalculator.java 1 0e1e Bootstraprethods weer 2006 D 11 EF eee? Geeec (Hae: Sjava/lang/invoke/StringConcatFactory aeei Ljava/lang/invoke/MethodHandless Lookupljava/Lung/String: Lja 2017 eee 2018 2012 2018 DeA Bele "" 148.D - P.143 2005 89 00 S teel 13 Q eees 2012 LP 2004 2003 2002 AB 0024 2003 RO 2002 IC 2001 KC eeei PRT 0019 er.gp ***gasas G MaxRange Calculator java" Max RangeCalculator.class Compile Messages GRASP Messages Run O Interactions GRASP exec: java MaxRangeCalculator Welcome to the MPG Calculator. Enter the miles per gallon (HPG): OD Clear Help Find Open Projects * NUO Projt Max Range Calculator start UML> Files ange Calculator java a user program arch

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

ISBN: 978-0764535376

More Books

Students also viewed these Databases questions

Question

What impact does Brazil have in the global economy?

Answered: 1 week ago

Question

BPR always involves automation. Group of answer choices True False

Answered: 1 week ago