0% found this document useful (0 votes)
33 views2 pages

Question File

The document outlines creating a package and classes to calculate vehicle mileage based on engine type (2 stroke or 4 stroke), fuel type (gas or diesel), cylinder volume, and fuel capacity. It provides the mileage calculation formulas for each combination and sample code to test the calculations, returning the expected mileage output. The goal is to create the classes and test the code to verify it works as outlined.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

Question File

The document outlines creating a package and classes to calculate vehicle mileage based on engine type (2 stroke or 4 stroke), fuel type (gas or diesel), cylinder volume, and fuel capacity. It provides the mileage calculation formulas for each combination and sample code to test the calculations, returning the expected mileage output. The goal is to create the classes and test the code to verify it works as outlined.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Create package com.

Create classes as per below outline:

Fuel type value should be either ‘g’ or ‘d’ (‘g’ indicating that engine runs on gas and ‘d’ indicates that
engine runs on diesel. Validation is not required. Just specify value as ‘d’ or ‘g’).

Mileage calculation formula:

Two Stroke Engine:

Gas:

Mileage = volume*2*3/1000 + fuelCapacity/2

Diesel:

Mileage = volume*2*2/1000 + fuelCapacity/4

Four Stroke Engine:

Gas:

Mileage = volume*4*3/1000 + fuelCapacity/2

Diesel:

Mileage = volume*4*2/1000 + fuelCapacity/4


Try below code from main method and verify the output:

Output:

Once done, submit the solution files over iAscert.

You might also like