Question
Define a Java class namely Bicycle containing: Instance variables: cadence: A private instance variable of type integer. speed: A private instance variable of type integer.
Define a Java class namely Bicycle containing: Instance variables: cadence: A private instance variable of type integer. speed: A private instance variable of type integer. gear: A private instance variable of type integer. Methods: full-parameterized constructor: a constructor method to initialize the instantiated objects. setCadence( xxx ): acts as the set method for the attribute cadence setSpeed(xxx): acts as the set method for the attribute speed setGear(xxx): acts as the set method for the attribute gear getCadence(): acts as the get method for the attribute cadence getSpeed(): acts as the get method for the attribute speed getGear(): acts as the get method for the attribute gear speedUp(int x): increases the current speed with x. speedDown(int x): decreases the current speed with x. toString(): returns a String contains the class attributes in the following format: cadence:speed:gear Define a Java class TestBicycle that contains a main method and test the functionality of the above class Bicycle as flowing: Create two objects of type Bicycle Name of object cadence Speed gear ByA 60 3 ByB 2 80 4 Change the speeds of ByA to 66 and ByB to 88 (without using the setSpeed method). Print the data of two objects ByA and ByB Part II) Define a Java class namely Employee containing: Instance variables: - id: A private instance variable of type integer. name: A private instance variable of type String. - salary: A private instance variable of type double. - workedHour. A private instance variable of type double. Methods: full-parameterized constructor: a constructor method to initialize the instantiated objects. setnamel xxx ): acts as the set method for the attribute name setid(xxx): acts as the set method for the attribute id setsalary(xxx): acts as the set method for the attribute salary setworkedHour(xxx): acts as the set method for the attribute worked Hour. getname (): acts as the get method for the attribute name getid (): acts as the get method for the attribute id getsalary (): acts as the get method for the attribute salary getworkedHour (): acts as the get method for the attribute worked Hour. display(): print the attributes id, name, and salary in the following format: id\",\"name\", \"salary\" Define a Java class TestEmployee that contains a main method and test the functionality of the above class Employee - Create three objects of type Employee Name of object id name workedHour salary Ea 101 Omar 50 2000 E 102 Khaled 70 2500 Ec 103 Ahmed 90 3500 In the main class define an array \"emplist\" that holds objects created in the previous step. In the \"emplist\" update the salary of all employees with worked Hour>40 as the following: Newsalary = salary+750; Print the updated salaries.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started