Thursday, September 10, 2015

Semester 7th : Do It Yourself - Java Practical Questions - 1

  1. Write a Java code that prints the numbers from 1 to 50. But •    for multiples of three print "Hi" instead of the number and
    •    for the multiples of five print "Five".
    •    For numbers which are multiples of both three and five print "HiFive
  2. Write a program to convert decimal number to binary number.
  3. Write a program to convert binary number to decimal number.
  4. Write a java code to find the distance from Jabalpur to major cities of India using Arrays.
  5. Write a program to print marksheet of student using OOPs concept.
  6. Write a program to display area, perimeter, volume of a triangle, rectangle and circle by applying OOPs concept.
  7. Write a Patient class which inherits from the Person class. You may also need to use the Money class.
    The Patient class requires the following:
    •   
    a variable to store the patient number for the patient
    •    a variable to store the hospital
    •    a variable to store the patient 's year of joining the hospital
    •    a variable to store the patient 's address
    •    a variable to store the medical fees that the patient pays
    •    constructor methods, which initialise the variables
    •    methods to set and get the hospital , year of joining and address
    •    a method to calculate the medical fees : It should take a Money object (the basic fee per year) as a parameter and use it to return the basic fee for the patient. A patient should pay the basic fee for the year of R 1200, 50.