Jgrasp shortcuts1/8/2024 ![]() ![]() MAILINGS REVIEW VIEW EEEEE 21 AaBbCeDd AaBbceDd AaBbci AaBbcc AaBl AaBbc 1 Normal 1 No Spac. Create a new class named PayProgram, save it as PayProgram.java (the file name MUST be Pay Program.java), and translate the following pseudocode into Java. Choose File New Java to begin a new Java class in the edit window. Compile your program with either of the following methods: Select the Build menu, select Compile Use the keyboard shortcut, CTRL-B Select the green plus sign from the icons + Employee.java is not runnable" since there is no main method. Make sure the class compiles without errors before continuing. Heading 1 Heading 2 1 Normal Title Subtitle Paragraph TE Styles 3 4 Public Module computeGrossPay() Set grossPay - PayRate *hoursWorked Display "Gross pay is", grossPay End Module End Class Save the file by choosing File/Save As using the name Employee.java, the file name MUST be Employee.java. Heading 1 Heading 2 Paragraph Public Module setPay Rate (Real newPay Rate If newPayRate > 0 Then Set pay Rate=newPayRate Else Display newPayRate, is not a valid pay rate." Set payRate=0 End If End Module Public Module setHours Worked (Real new Hours Worked) If newHours Worked > 0 Then Set hoursWorked = new Hours Worked Else Display new Hours Worked" is not a valid value for hours worked." Set hoursWorked = 0 End If End Module Public Module computeGrossPay() Set grossPay = payRate hours Worked Display Gross pay is", grossPay End Module End ClassĢ1 Аавьсера) Аавьссера Аавьс Аавьсс Аав Аавьсер 1 No Spac. o o o o Class Employee Private Real payRate Private Real hours Worked Private Real grossPay Public Module Employee () Set payRate=0.0 Set hoursWorked -0.0 Set grossPay = 0.0 End Module Public Function Real get PayRate() Return payRate End Function Public Function Real get Hours Worked () Return hours Worked End Function Public Function Real getGrossPayO Return grossPay End Functionġ Normal 1 No Spac. Take note that the payRate, hoursWorked and grossPay are type double in Java. Using the steps in the Practice Problems as a model, translate the pseudocode for the classes below into Java and create the classes in Java using ¡Grasp. Choose File/New/Java to begin a new Java class in the edit window. Choose File/Close All to close all your currently open files.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |