Introductory to object-oriented programmin UE Past Papers Questions.


View All Courses

(1493) Question Category: Practical

Create a Java application with class name Test1. That class should contain two integer variables declared as argument of a method called sum(). This method computes the sum of these two values variables. The method should display the results. In turn call the method in main(), passing the values of the two integer variables.

Answer / Solution

UNSOLVED

(1494) Question Category: Short answers

Given the following piece of Java codes, examine carefully , identify errors and fill them in the table below:

public Class product(){

public static void giveName[String name, int size]{

System.out.printline(“Our product is ”+ name +” Our product size is ”+size);

}

public static void Main(String[] args){

GiveName(“Asaki”,)

}

}

No. Error Correction
1 Class class
2    
3    
4    
5    
6    

 

Answer / Solution

UNSOLVED

(1692) Question Category: Practical

Write a Java program called LipaKwaSimu that performs transactions as described below;

  1. Upon running it, it should display the Main Menu with the following services, Luku and DSTV, with each service preceded by an integer 1 and 2 respectively such that 1 Luku and 2 DSTV.
  2. The customer should choose the desired service by entering the corresponding  integer, for instance 1 for Luku and 2 for DSTV. If a different integer (neither 1 nor 2) is entered the program should display the message “No such srvice” and then quit. The description for each service is such that:
  1. When Luku is selected the customer should be allowed to enter any six digit number to act as a customer`s Luku meter number, after which he/she should be allowed to enter amount of money for buying electricity. The minimum amount allowable should be TSH 1500 and the price for each unit should be THS 250. After entering the correct amount, total units of electricity bought should be displayed . If less than TSH 1500 is entered , the program should display” The amount should be at least TSH 1500”, then take the customer to the beginning of the LUKU service to start afresh.
  2. When DSTV is selected, the customer should be given a welcome note and a message that says ``Sorry , the system is under maintenance Please visit another  time``

Answer / Solution

Unlock

(1710) Question Category: Practical

In a class called Test1, write a method called showRemark, this method takes one argument called rowMark. It check the given row mark and give a remark on the condition that , if row mark is greater than or equal to 50 but less than or equal to 100 it assigns PASS, if row mark is greater or equal to 0 but less than 49 it assigns FAIL, otherwise INVALID MARKS. Invoke this method into the main method and let the user enter the row marks from the keyboard. Create separate file with a class called Test2 that inherits Test1 class. The new class should override the showRemark method to just display simple message “This is overriding concept” . Create an object that uses this method. Save , compile and execute your files.

Answer / Solution

Unlock

(4367) Question Category: Multiple choices

Which of the following is not a type of class?

  1. Abstract
  2. Final Class
  3. Start Class
  4. String Class

Answer / Solution

UNSOLVED


View All Courses
News & Updates | Recently
Recent Updates
questions

2024-05-02: questions

Questions Uploaded on 2024-05-02


questions

2024-03-29: questions

Questions Uploaded on 2024-03-29


questions

2024-03-19: questions

Questions Uploaded on 2024-03-19

Dismissible in 10 seconds