CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades | Students

Assignment #2

Calculate travel time based on distance and speed

Due Date: Monday of Week 2
10 points

This project uses integer arithmetic to calculate travel time based on distance and speed.

Console

Operation

  • The application prompts the user to enter values for miles and miles per hour.
  • The application displays the approximate travel time in hours and minutes.
  • The application prompts the user to continue.

Specifications

  • The application should accept decimal entries like 10.5 and 20.65.
  • Assume that the user will enter valid data.
  • The application should continue only if the user enters "y" or "Y" to continue.

Hint

  • Use integer arithmetic and the division and modulus operators to get hours and minutes.
Include in your program the following comments:
  • Name of program
  • Programmer's name
  • Current Date
  • Computer system and compiler you are using
  • Brief description of the program

Compile and run the Java program.

Take a screen capture by hitting simultaneously the keys Alt and Print Screen (Prt Sc) of the output results (console) and paste it in MS Paint. Save it as a gif file.

When you are ready, upload the java program and the gif file by clicking the link below:

Upload Assignment

I cannot grade if I don't get the files and receive your email.