Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add some data input from the user for his or her name Add some data input from the user for the destination of the trip

  • Add some data input from the user for his or her name
  • Add some data input from the user for the destination of the trip
  • Report back to the user with an output message similar to the following (don't copy my output statements exactly - make up your own):
  • Add a results message categorizing the mileage in 1 of 3 categories.

Sample Output:

  • Charles Costarella, your trip to Whitehorse was very economical.
  • You traveled xxx miles to reach your destination.
  • You consumed yy.y gallons of fuel.
  • You achieved a fuel efficiency rating of zz.z miles per gallon!
  • With an MPG rating of over 30.0, this is considered very good.

Here is a second example:

  • Charles Costarella, your trip to Whitehorse was economical.
  • You traveled xxx miles to reach your destination using only yy.y gallons of fuel.
  • Your fuel efficiency rating on this trip was zz.z mpg.
  • With an MPG rating approaching 30.0, this is considered acceptable.

And finally:

  • Charles Costarella, your trip to Whitehorse was not very economical.
  • You traveled xxx miles to reach your destination, but your vehicle used yy.y gallons of fuel.
  • This is only zz.z miles per gallon.
  • With an MPG rating under 20.0, this is a cause for concern.

Now test run your program.

  • Produce the following 3 different compile time errors (make your code produce only 1 error at a time - rebuilding in between errors/tests)
    • a missing semi-colon
    • a missing closing curly brace, and
    • a mismatch of data types across an attempted assignment
    • Take a screen shot of the error message (use the Snipping Tool and crop tightly so I can read it clearly)
    • You will re-write (paraphrase the message, do not copy and paste) the error messages in this assignment, and explain what the compiler's error message is trying to tell you. Do not use NA, Not sure, or similar as an answer. You must explain what happened and the resulting message.
  • Fix your code so it works correctly but will produce the following runtime errors on separate program runs (each of these mismatches the data input with what the program was expecting in some way):
    • a missing input value (press Enter when prompted for an input)
    • received string - expected int
    • received double - expected int
    • received double - expected string
    • when asked for gallons, enter 0
    • Re-write (paraphrase the message, do not copy and paste) the error messages in this assignment, and explain what the runtime error message is trying to tell you. Explain what happened and the resulting message.
    • Screenshot the exception - use the Snipping Tool and crop tightly so I can clearly read the stack trace in the output window

Answer the following questions concerning Visual Studio 2017 (make sure you have Tools->Options->Environment->Keyboard set to "Visual C# 2005" in the drop down at the top.

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions