Professional Documents
Culture Documents
Homework Eng
Homework Eng
It is necessary to write a program that simulates the operation of a TV. Provide it with the ability to
switch channels: the next channel, the previous channel, the transition to the channel by number. Note
that a channel cannot have a negative number. When launched, the program should show the current
channel and offer to switch the channel by pressing any button on the keyboard. You can display the
current channel simply as a number and name. After launching the application, the program should
constantly offer to switch channels and only after the user decides to turn off the TV, end the program.
Directions:
o fields / attributes:
o constructor:
o three methods:
Task 2 “Elevator”
It is necessary to write a program that simulates the operation of an elevator in an 18-story building.
When launched, the program should ask which floor and how much weight to take. If the floor number
or load is invalid, then throw an error and wait for re-entry. If the floor number and the load are valid,
then print the numbers of floors that the elevator will reach as a result of the movement in order, then
ask again which floor and what weight should be taken.
Directions:
o fields / attributes:
o constructor:
Move(toFloor) - moves the elevator to the desired floor and displays messages about
reaching each of the floors that it passes along the way
IsAllowableWeight(weight) - the method must return true if the specified weight is
allowed
IsAllowableFloor(floor) - the method must return true if the specified floor is allowed
When listing the floors that the elevator passes, take into account the current floor from which the
countdown starts.
After starting the application, the program should constantly offer to enter the floor to which it is worth
moving, and only after the user decides to turn off the elevator, complete the program.
You print menu in a loop with available functionality. Program should allow to:
5) quit application.
class Student should have following fields: 1) id, 2) name, 3) age, 4) phone.
application class should have ArrayList of students and maintain interactive logic.
Requirements:
2) [5%] You should check the length of the phone string, [10%] and perform additional reasonable
checks on the phone string.
====================
====================