Chat with us, powered by LiveChat OBJECT ORIENTED PROGRAMMING - Writeden

SPRING COSC 1437 – LAB3 TITLE OBJECT ORIENTED PROGRAMMING: Datatype class, Driver class – Adult, Adult BMI Rate– Employee, Two Weeks Salary of the Employee HOW TO DO EACH PART From now on, we are going to write the code with OBJECT ORIENTED PROGRAMMING that requires two different types of classes in one project, the DATATYPE class and the DRIVER CLASS. We do the lab with the following steps: STEP1: CREATE THE UML FOR THE DATATYPE CLASS, THE PSEUDO-CODE FOR THE DRIVER CLASS AND LEARN JAVA SYNTAX BEFORE WRITING THE CODE 1. Read the lab requirement then figuring out: -What object does the requirement talk about? to create the UML of the datatype class -Name the object and figure out the list of all information that can describe the object relating to the requirement ➔ declare these information as variables that are called the attributes or the fields or the data members of the object. -Also, figure out and list all the tasks that are needed to describe relating to the object to solve the problem of the requirement. Each task will be provided in one method. -With the above list of the above variables and methods, create the UML of the object as the design of the object before writing the code of the datatype class that includes data members, constructors and all the required methods. -Next, before writing the code of main() in the driver class, create the pseudo-code that includes steps reading input from the users to have enough information to create the object that is described in the datatype class, then create the object and use the object to access the methods that are described in the datatype to come up the solution. 2. Learn the Java syntax to translate the UML into java code of the datatype class and translate each English step in the pseudo-code to Java code (that means write the java code). If you need help on this step, read the topics relating to the action of each step in HOW TO DO LAB to learn the java syntax. 3. When you are ready with java syntax that needs for the lab, you bring up the eclipse or other editor to start writing java program. STEP2: CREATE THE JAVA PROJECT AND WRITE THE JAVA CODE *From now and on yourLastName will be changed to your last name *Your program should change Martinez to your last name *Change LUIZ MARTINEZ to your full name *write the file name as the first comment line at the top of program. The java comment line starting with // as the comment line in java *After running your program successfully, take the picture of the output window and paste the picture at the bottom of the document having pseudo-code to turn in 1. Start editor eclipse, create the project → write the project name Project name of the Part 1: SP2024_LAB3PART1_yourLastName Project name of the Part 2: SP2024_LAB3PART2_yourLastName 2. Add the class with the class name. Class name will be the file name. Part1: add datatype class:; SP2024_Adult_yourLastName Add the driver class: SP2024_BMIRateOfAdult_yourLastName Part2: add datatype class: SP2024_Employee_yourLastName Add the driver class: SP2024_BiWeeklySalaryOfEmployee_yourLastName STEP3: COMPILE THE CODE AND FIX THE ERRORS STEP4: RUN THE PROGRAM *With eclipse, the project will be automatically compiled, creates the object file .class then run to provide the output on the Console window if the code with no syntax errors. TO KNOW HOW TO WRITE THE CODE OF A DATA TYPE CLASS AND HOW TO CREATE AN OBJECT AND USE THE OBJECT TO ACCESS THE METHODS OF DATA TYPE CLASS IN THE DRIVER CLASS; YOU CAN GET HELP BY READING THE TOPICS RELATING TO THESE IN “HOW TO DO LAB” AND FOLLOW THE INSTRUCTION IN THIS LAB. FOR ANY QUESTIONS, CONTACT VIA EMAIL LiemLe@dcccd.edu OR JOINT TO OFFICE HOUR TO GET HELP. LAB3 PART1 REQUIREMENT: We use the same the requirement of Lab2 Part2: Provide UML, pseudo-code, and a Java application to help users to calculate the BMI rate of Adults. BMI (Body Mass Index) is a measure of body fat based on height and weight of adult men or women. The application should display message to ask and read from the keyboard users to enter the users’ information from the keyboard about: *The name of user (string) *Height in inches (int) *Weight in pounds (int) The formula to calculate BMI: BMI = (weight * 703) / (height * height) The BMI rate result is a decimal number and displayed with 9 output lines in the following and BMI rate will be in 2 decimal digits. DATATYPE CLASS From this requirement, you can see the requirement talks about the BMI rate of the adult. Therefore, we choose the object adult to create the datatype class SP2024_Adultt_yourLastName -The information of one adult needed for this project includes name, height, and weight (3 data members) -The tasks we need to do with the object of class Adult in this project are calculating BMI rate and displaying the required result output (create 2 functions) => CREATE THE UML OF DATATYPE CLASS SP2024_Adult_yourLastName. You can use the table of Word document to create the UML SP2024_Adult_Martinez Class name is aligned in center -name: String -height: int Attributes, fields, data members -weight: int +SP2023_Adult_Martinez() No argument constructor +SP2023_Adult_Martinez(name:String, weightlift, weight:int) Parameterized constructor +calculate_BMIRate(): double +toString(): String Method calculate_BMIRate() Method toString() =>Download the class Adult.java from ecampus then add it to your lab3 part1 project with the name SP2024_Adultt_yourLastName to have the Datatype class. DRIVER CLASS Before writing the code, you must create the pseudo-code for the main() that lists step by step what we suppose to do in main(). Using Object Oriented Programming, we will do different from Lab2 part2. The driver class named SP2024_BMIRateOfAdult_yourLastName includes the function main(). In the function main(), after reading all the information of one adult that are needed for name, height and weight, you must create the object of the data type class SP2024_Adult_yourLastName by accessing the parameterized constructor of the data type class to pass all required information to the object, then use this object to access the method toString() to display the result of the BMI rate. LAB3 PART2 REQUIREMENT; Using Object Oriented Programming to provide the UML, pseudo-code, and the application SP2024_BiWeekSalaryOfEmployee_yourLastName that helps employees to print out their two weeks salary slip. You must provide two classes: data type class: SP2024_Employee_yourLastName driver class: SP2024_BiWeekSalaryOfEmployee_yourLastName. DATATYPE CLASS Class SP2024_Employee_yourLastName The application talks about the salary of the employee; therefore, we select the object of this project as employee and provide the datatype class SP2024_Employee_yourLastname. * Provide the UML of this class before writing the code This class holds the following: –the information of the employee about employee id (String), employee name(String), hourly salary (float) and number of work hours in two weeks (int). –provide 5 methods: *the method to calculate the gross pay amount *the federal income tax amount *the social security tax amount, *the Medicare tax amount, *net pay amount The tax rates should be declared as constants: Federal Income tax rate = 8.74% Social Security tax rate = 6.20% Medicare tax rate = 1.45% Formulas: Gross pay amount = salary rate * number of work hours in two weeks Federal Income tax amount = Gross pay * Federal Income tax rate Social security tax amount = Gross pay * Social Security tax rate Medicare tax amount = Gross pay * Medicare tax rate Net pay amount = Gross pay amount – (Federal Income tax+ Social Security tax+ Medicare tax) Method toString() creates the output string that needs in the following format: in the following format that requires the information in correct alignment and the numbers in two decimal digits. DRIVER CLASS Provide pseudo-code and the driver class SP2024_BiWeeklySalaryOfEmployee_yourLastName This application will help employees to calculate the Net pay in two weeks. After the users provide from the keyboard the employee Id, employee name, hourly salary, and number of work hours in one week; then create the object of class Employee and use this object to access the method toString() of datatype class to display the output of on the screen HOW TO TURN IN THE LAB ATTENTION: Compress each project folder into a file .zip or a file .rar. that includes source files and class files. -If you do not have the source file and file .class, your lab gets 0 points -If you do not provide file .class of the part, you only have half of the max score of the part You should turn in the following files: 1.Lab3_UML_PseudoCode_yourLastName.docx (including UML, Pseudo-code, and the output pictures of both parts) 2.SP2024_LAB3PART1_yourLastName.zip (including SP2024_Adult _yourLastName.java, SP2024_AdultBMI_Calculator_DriverClass_yourLastName.java SP2024_Adult _yourLastName.class, SP2024_AdultBMI_Calculator_DriverClass_yourLastName.class) 3.SP2024_LAB2PART2_yourLastName.zip (including SP2024_Employee_yourLastName.java, SP202_BiWeeklySalaryOfEmployee_yourLastName.java SP2024_Employee_yourLastName.class, SP2023_BiWeeklySalaryOfEmployee_yourLastName.class HOW TO GRADE THE LAB Submit the lab on time 3 Part 1: copy UML of class Adult, pseudo-code , output pictures 1 Part 1: data members of class Adult, private, data types 0.5 Part 1: no-argument constructor, parameterized constructor 1 Part 1: method calculate weight, method toString() 1 Part 1: Read input 0.5 Part 1: create the object 1 Part 1: display the output by calling method toString() 1 Part 1: output in the requested format 2 Part 1: submit requested files, compile success, qualified the requirement 3 Part 1: File name as comment at top and write the comment 1 Part 2: UML of class Employee, pseudo-code 2 Part 2: data members, define constants for all rates 0.5 Part 2: no-argument constructor, parameter constructor 1 Part 2: methods to calculate moneys 2 Part 2: method toString – prepare for the output 1 Driver class Part 2: read input 0.5 Part 2: Create the object 1 Part 2: Display the output by access the method toString() 1 Part 2: output in the requested format 2 Part 2: submit requested files, Compile success, qualified the requirement 3 Part 2: filename as comment and Write comments 1 Total 30