Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Five individual exercises covering all topics of the module. Exercise A.1 [5%] In this Exercise you will create multiple methods in one class called
Five individual exercises covering all topics of the module. Exercise A.1 [5%] In this Exercise you will create multiple methods in one class called ExerciseA1 for A.1A and A.1B and call them in A.1C. Exercise A.1A [2%] Add a method to ExerciseAl called convertFahrenheitToCelsius that receives a value as a double and converts this value from Fahrenheit to Celsius. The converted value should be returned by the method as a double. The formula for the conversion is celsius = (fahrenheit - 32) * 5/9 Exercise A.1B [2%] Add a method to ExerciseA. 1 called printKg Pounds without parameters that returns void that prints the corresponding weight in pounds for 1 to 199 kilograms skipping every second value and starting with one (1 kilogram is 2.2 pounds). For example: 1 2.2 3 6.6 197 433.4 199 437.8 Exercise A.1C [1%] Add a main method and call convertFahrenheitToCelsius and printKg Pounds. Exercise A.2 [4%] In this Exercise you create several classes and use inheritance and encapsulation. Implement a class called Person. Implement two subclasses of Person called Student and Employee, Implement two subclasses of Employee called Academic and Staff. A person should have variables for a name, address, phone number and e-mail. Students should have a status (undergraduate, postgraduate or research). The status should be a constant. All employees should have variables for an office, salary and hiring date. Define a separate class for the date containing variables for year, month and day and use it for the hiring date. Academics have variables for office hours and a rank. Staff members have a variable for a role. For all classes (except the date) override the toString method to print the name of the class and the name of the person. Use appropriate access modifiers for all variables. Add a main method in a class called ExerciseA2, create one object of each class and print them to the command line. Exercise A 3 159/1
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