You are on page 1of 2

King Saud University

College of Computer & Information Science


CSC111 – Assignment 3
All Sections
-------------------------------------------------------------------

Submission Instructions:
1. Due date: Sunday, October 3rd, 2021 at 11:59 pm
2. You can discuss answers with your colleagues, but cheating is
prohibited and there will be extreme consequences.
3. Submit it to lms.ksu.edu.sa. Email submissions will not be accepted.
4. All classes in one java project.
5. The exported project name must be:
Assignment03_ID_FirstName_LastName.zip. For example:
Assignment03_123456789_Marwan_Almaymoni.zip
6. Use the default package.
7. Write your name and university ID as a comment at the start of all java
files.

Question 1
Write a program that prompts the user to enter the distance to drive, the fuel
efficiency of the car in kilometers per liter, and the price per liter, and displays
the cost of the trip. Use the class name Fuel.

Here is a sample run:


Enter the driving distance: 900.5 ↵
Enter kilos per liter: 25.5 ↵
Enter price per liter: 3.55 ↵
The cost of driving is $125.36372549019607

Enter the driving distance: 423.3 ↵


Enter kilos per liter: 31.4 ↵
Enter price per liter: 6.16 ↵
The cost of driving is $83.04229299363058

You might also like