Loading...
Design a class with the following specifications: Class name: Student Member variables: name – name of student age – age of student mks –marks obtained stream – stream allocated (Declare the variables using appropriate data types) Member methods: void accept() – Accept name, age and marks using methods of Scanner class. void allocation() – Allocate the stream as per following criteria: mks | stream > = 300 | Science and Computer > = 200 and < 300 | Commerce and Computer > = 75 and 200 | Arts and Animation < 75 | Try Again void print() – Display student name, age, mks and stream allocated. Call all the above methods in main method using an object.
DTDC a courier company charges for the courier based on the weight of the parcel. Define a class with the following specifications: class name: courier Member variables: name – name of the customer weight – weight of the parcel in kilograms address – address of the recipient bill – amount to be paid type – ‘D’- domestic, ‘I’- international Member methods: void accept ( ) – to accept the details using the methods of the Scanner class only. void calculate ( ) – to calculate the bill as per the following criteria: Weight in Kgs | Rate per Kg First 5 Kgs | Rs.800 Next 5 Kgs | Rs.700 Above 10 Kgs | Rs.500 An additional amount of Rs.1500 is charged if the type of the courier is I (International) void print ( ) – To print the details void main ( ) – to create an object of the class and invoke the methods
Define a class named CloudStorage with the following specifications: Member Variables: int acno - stores the user's account number. int space - stores the amount of storage space in GB purchased by the user. double bill - stores the total price to be paid by the user. Member Methods: void accept() - prompts the user to input their account number and storage space using Scanner class methods only. void calculate() - calculates the bill total price based on the storage space purchased using the pricing table provided: Storage range | Price per GB (Rs) First 15 GB | 15 Next 15 GB | 13 Above 30 GB | 11 void display() - displays the account number, storage space and bill to be paid. Write a main method to create an object of the class and invoke the methods of the class with respect to the object.
Define a class named StepTracker with the following specifications: Member Variables: String name — stores the user's name. int sw — stores the total number of steps walked by the user. double cb — stores the estimated calories burned by the user. double km — stores the estimated distance walked in kilometers. Member Methods: void accept() — to input the name and the steps walked using Scanner class methods only. void calculate() — calculates calories burned and distance in km based on steps walked using the following estimation table: Metric | Calculation Formula Calories Burned | steps walked × 0.04 (e.g., 1 step burns 0.04 calories) Distance (Km) | steps walked / 1300 (e.g., 1300 steps is approx. 1 km) void display() — Display the calories burned, distance in km and the user’s name. Write a main method to create an object of the class and invoke the methods.
© 2026 PadhAiPro. This question is provided for educational purposes.