write a login system shall verify the username and password. If wrong username, please show the error message: Wrong username, please check and the re-enter your username. If wrong password, please show the error message: Wrong password, please check and re-enter your password.
Display message to ask the input from user (1 mark)
User name and password validation ( 2 marks)
Display the error message. (2 marks)
Proper use of loop so the user could re-enter the username/password when wrong input ( 2 marks)
A box of cookies can hold 24 cookies and a container can hold 75 boxes of cookies.
Write a java program that prompts the user to enter the total number of cookies. The
program then outputs the number of boxes and the number of containers to ship
the cookies. Note that each box must contain the specified number of cookies and
each container must contain the specified number of boxes. If the last box of
cookies contains less than the number of specified cookies, you can discard it, and
output the number of leftover cookies. Similarly, if the last container contains less
than the number of specified boxes, you can discard it, and output the number of
leftover boxes
Create a program that will read the values of A and B. Compare the two values of A & B then print which of the values is higher including the remark “Higher”
Create a Person class that implements the methods:
Person(name:String, address:string),
get name() : String.
getAddress(): String.
setAddress(address:String):void.
A person should have a last name and an address. It should also be possible to display this information using the toString() method.
Create a Student class that implements the methods:
Student (name:String, address: String, program:String, year:int, fee:double)
getProgram():String
setProgram(Program:String):void
getYear():int
setYear(year:int):void
getFee():double
setFee(fee:double):void
toString():String
Create a Staff class that implements the methods:
Staff(name:String, address:String, school:String, pay:double)
getSchool():String
setSchool(school:String):void
getPay():double
setPay(pay:double):void
Staff must have a school name (School) and a salary (pay). It should also be possible to display this information using the toString() method.
Car is an object that helps us in transportation. Analyze the concept and identify the data members and methods that should be included in Car class.
Write a program using one-dimensional array that determines the highest value among the five input values from the keyboard and prints the difference of each value from the highest.
enter five numbers: 10 20 15 7 8
the highest is: 20
the difference from the highest are:
20 – 10 = 10
20 – 20 = 0
20 – 15 = 5
20 – 7 = 13
20 – 8 = 12
Write a program using one-dimensional array that determines the highest value among the five input values from the keyboard and prints the difference of each value from the highest.
the result would be:
Enter ten numbers:
8 9 7 10 25 30 69 101 1001 798
Here is the list of Even number/s:
8 10 30 798
a)
Define ADT class MyQUEUE and MyStack implemented using Linked List data structure.
b)
Using class Book defined earlier, complete the AppQueueBook class :
In the main program:
a.
Declare a queue of books object named BookQ
b.
ask user to enter 10 Book objects into queue BookQ
c.
Display all books details in BookQ
d.
Display all books which were published before year 2000.
e.
Search and display a book with the lowest price.
f.
Declare another queue of books object named BookQOld, all books published before year
2000 should be copied into this queue
c)
Using class MyStack defined earlier, complete the AppStack class :
In the main program:
a. Evaluate the postfix expressions entered by user and display the result.
- Person class
Create a Person class that implements the above methods. A person should have a last name and an address. It should also be possible to display this information using the toString() method.
- Student class
Create a Student class that implements the above methods. Student must have a program, a year and fee. It should also be possible to display this information using the toString() method.
- Staff class
Create a Staff class that implements the above methods. Staff must have a school name (School) and a salary (pay). It should also be possible to display this information using the toString() method.
Define a Car class with the following attributes: Id, Brand, Speed, Power.
Define a constructor allowing the attributes of a car object to be initialized
by values passed as parameters. Knowing that Id must be auto-increment.
Define the accessors to the different attributes of the class.
Define the toString () method to display the information of a car.
Write a Java program to test the Car class by creating an array of cars.
Display all their attributes, and give the total number of the cars