0% found this document useful (0 votes)
35 views

Assignment 12: K.E. Carmel School, Amtala

This document contains 3 questions asking to write Java programs to: 1) Create a menu-driven program to perform conversions between feet to cm, years to hours, and centigrade to fahrenheit based on user input. 2) Define a class called AppCab to calculate cab fares based on kilometers traveled and output the cab number, passenger name, km traveled, and bill amount. 3) Accept customer name, parcel weight, and delivery mode (national or international) and calculate total charges for the parcel based on weight thresholds and delivery rates. Output the customer name, mode, weight, and total charge.

Uploaded by

AtanuBhandary
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Assignment 12: K.E. Carmel School, Amtala

This document contains 3 questions asking to write Java programs to: 1) Create a menu-driven program to perform conversions between feet to cm, years to hours, and centigrade to fahrenheit based on user input. 2) Define a class called AppCab to calculate cab fares based on kilometers traveled and output the cab number, passenger name, km traveled, and bill amount. 3) Accept customer name, parcel weight, and delivery mode (national or international) and calculate total charges for the parcel based on weight thresholds and delivery rates. Output the customer name, mode, weight, and total charge.

Uploaded by

AtanuBhandary
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

K.E.

CARMEL SCHOOL, AMTALA


Virtual Class, 2020–21 Class–IX
Subject–Computer Applications
Assignment 12
Question 1:
Write a menu driven program in Java to perform either of the following conversions depending on the User’s
Choice
i) feet to cm
ii) Year to hour
iii)Centigrade to Fahrenheit
[Where: 1 inch=2.54 cm, 12 inch=1feet,1 year=365 days ,1day=24 hours]
Question 2
Define a class AppCab having the following description:
Data members/instance variables
int cabno :to store cab number
String name : to store passenger’s name
int km : to store number of kilometres travelled
Member Functions/Methods:
AppCab( ) — constructor to initialize taxino to 0, name to “ ”and km to 0.
void input( ) – to accept cabno,name,km
calculate( ) – to calculate bill for a customer according to given conditions
kilometers travelled(km) Rate/km
≤ 1 km Rs 25
1 < km ≤ 6 Rs 10
6 < km ≤ 12 Rs 15
12 < km ≤ 18 Rs 20
>18 km Rs 25
display( )- To display the details in the following format
Cabno Name Kilometers travelled Bill amount
……. …….. …………………… ………….
Create an object in the main method and call all the above methods in it.

Question 3:
A transport company transport parcel in two different mode, National and International & charges for the
parcels as per given tariff.
Weight National Charge International charge
Up to 10 kg Rs 20/kg Rs 35/kg
For the next 20 kg Rs 40/kg Rs 60/kg
For the next 12 kg Rs 55/kg Rs 70 /kg
More than 42 kg Rs 60/Kg Rs 80/kg

Write a program in JAVA to accept customer name, weight of parcel and mode of
delivery(National/International).Calculate total charge for parcel.Print total charge along with Customer’s
name, mode , weight of percel.

You might also like