Question 1. [10]
Write a program to make a function to find the smallest digit of an integer that is input by the user.
Sample input : 6524
Sample output : Smallest digit is 2

Question 2. [15]
Define a class Taximeter having the following description:
Data members/instance variables
int taxino – to store taxi number
String name – to store passenger’s name
int km – to store number of kilometres travelled
Member functions:
Taximeter()- default constructor to assign default values to the data member.
Taximeter (int tno, String nm, int k) – to store taxino ,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
Taxino Name Kilometres travelled Bill amount

Create an object in the main method and call all the above methods in it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here