You are on page 1of 2

Course Code CCP112

Description Computer Programming 2 - Java

College / Department:
LabExer No. 2
HE – Department of Computer Studies

LABORATORY EXERCISE Page 1 of 1

Intro to Java

For resources on Java Programming, you may visit https://www.oracle.com/java/index.html

CREATE A JAVA PROGRAM


Direction: Create a program based on the given below.

1. DISTANCE TRAVELED
Assuming there are no accidents or delays, the distance that a car travels down the interstate can be
calculated with the following formula:
Distance = Speed x Time
A car is travelling at 60 miles per hour. Design a program that displays the following:
- The distance the car will travel in 5 hours
- The distance the car will travel in 8 hours
- The distance the car will travel in 12 hours

2. SALES TAX
Design a program that will ask the user to enter the amount of a purchase.
The program should then compute the state and country sales tax.
Assume the state sales tax is 4 percent and the country sales tax is 2 percent.
The program should display the amount of the purchase, the state sales tax, the country sales tax,
the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the total sales
tax).
Hint: Use the value 0.02 to represent 2 percent, and 0.04 to represent 4 percent.

3. MILES-PER-GALLON
A car's miles-per-gallon (MPG) can be calculated with the following formula:
MPG = Miles driven / Gallons of gas used used
Design a program that asks the user for the number of miles driven and the gallons of gas used.
It should calculate the car's miles-per-gallon and display the result on the screen.

What to submit:

1. Program codes and screen captured from your IDE (JCreator, Netbeans, Online Java Compiler, etc) and
pasted in the provided template.
2. Output Screen Captures – every output of the program
3. Explain every output of your program.
Rubrics:   
Criteria (%)  4  3  2  1 
Correct output Program displays Output has minor Output has Output is
(40%)  correct output with errors   multiple errors   incorrect  
no errors  
Design of output Program displays Program displays Program does not Output is poorly
(20%)  more than minimally display the designed  
expected   expected output   required output  
Standards  Program is Few inappropriate Several Program is poorly
(20%)  stylistically well design choices inappropriate written 
designed   (i.e. poor names design choices
for tags, improper (i.e. poor names
indentation)   for tags, improper
indentation) 
Effective Answer to Answers to Correct Failure to explain
Communication / questions is questions are understanding of and justify
Concept correct, correct, but some the problem, but workings of the
Understanding reasonable, and justifications was unable to code submitted
(20%)  reflective of the provided are explain the will automatically
code. The weak.  workings of code merit 0 for this
justifications provided.  course output 
provided are
sound. 
 
 
 

You might also like