ICSE Practice test 2 class X : Top Questions
Question 2. [15]Define a class Taximeter having the following description:Data members/instance variablesint taxino - to store taxi numberString name - to store passenger's nameint km - to store number of kilometres travelledMember functions:Taximeter()- default constructor to assign default values
Watch Java videos
In this ICSE practice test all the topics of java for ICSE computer application has been covered.
ICSE Practice test
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.
ICSE Practice test
String Handling
Related Posts
Continue learning with these related articles
Sum of First n Natural Numbers in Java (Loop and Formula)
Find the sum of the first n natural numbers in Java with a for loop, a while loop and the formula n(n + 1)/2, with a dry run and the sums of even numbers, odd numbers, squares and cubes.
Prime Number Program in Java: Check a Number and Print Primes in a Range
Check whether a number is prime in Java by counting its factors, a faster square-root method with isPrime(), and a program that prints all prime numbers in a range.

Encapsulation, Access Specifiers and Scope of Variables in Java for ICSE Class 10
ICSE Class 10 Computer Applications notes on encapsulation: private, default, protected and public access, data hiding with getter and setter methods, instance vs static (class) variables, local variables and scope, with a solved BankAccount program.