CIS355 Lab 2 – GPA Calculation and Currency Conversion Programs

Published on January 2018 | Categories: Public Notices | Downloads: 81 | Comments: 0 | Views: 232
of 1
Download PDF   Embed   Report

In this lab, you will create two programs that use classes and methods. Deliverables Program files for the following program 1.StudentGPAInfo 2.CurrencyConversion At the beginning of all your programs, put a comment box that includes the program name, your name, and a brief description of the program. Example: /*********************************************************************** Program Name: ProgramName.java Programmer’s Name: Student Name Program Description: Describe here what this program will do ***********************************************************************/ How to submit your assignment: 1.The programs must have the same names as the assignment title. 2.Each Java source file (*.java) must include a corresponding class file (*.class) program as evidence of success. 3.In addition to the program source code files and byte code files, put all your program source code files and screen shots of your program output files into a Word document. 4.You must use a zipped folder to send your weekly assignment to the Dropbox. Do not send subfolders within your zipped folder. Place all of the .java and .class files for the week into the one zipped folder. The zip folder should be named CIS355A_YourLastName_iLab_Week2, and this zip folder will contain all the weekly programming assignments. Step 1: StudentGPAInfo (20 points) Create a class called StudentGPAInfo.java that contains one double-precision instance variables named gpa. It should also contain two integer instance variables named totalgradepoints and numberofclasses. Finally, there should be one instance variable named studentname of string type. The class should include a constructor that initializes the name, numberof classes, and totalgradepoints variables, as well as a default constructor. Also, you need an instance method named calculateGPA() that calculates the student’s grade point average by using this formula: totalgradepoints divided by numberofclasses. Also, you need an instance method. Create one set method that will assign values to the studentname, totalgradepoints, and numberofclasses variables. Create a displayStudent method that will display all of the attributes of the StudentGPAInfo object. Display the GPA with an accuracy of two decimal places (i.e., 3.25). Write a class called GPATest.java. Create one StudentGPAInfo object named student1 using constructor that allows you to pass values to the object. Pass any values you would like to use. Create another StudentGPAInfo object named student2 using the default constructor. Using the set method, assign values to the student2 object. Next, use the calculateGPA() methods on both objects, then invoke the displayStudent() method on each of the objects. Grading Rubric StudentGPAInfo Points Description Standard header included 1 Must contain program’s name, student name, and description of the program Program compiles 2 Program does not have any error Program executes 2 Program runs without any error Created StudentGPAInfo class 3 Program contains the StudentGPAInfo class Constructor created that initializes variables 2 A constructor method exists in the StudentGPAInfo Contains all other methods 2 Set, calculateGPA, and display methods GPATest class, which drives the application, is created 4 A driver class with the main method Correct output is displayed 4 Program displays the name, total points, total classes, and GPA for both objects Subtotal 20 STEP 2: CurrencyConversion (20 points You must create a program named CurrencyConversion.java that converts money between the following currencies. Given one of the three currencies, the program should convert the input amount into one of the other currencies. For example, if you input one (1) U.S. dollar, and you decide to convert that one dollar to a pound, then the output should be .60. Using the JOptionPane GUI, do the following. Prompt the user for the currency code type. Prompt the user for the currency code that the entered amount must be converted to. Using the table above, the following formula was used to convert USD to JPY. 10.00 * 103.73 = 1,037.30 Display the results in a JOptionPane message box. CurrencyConversion Points Description Standard header included 1 Must contain program’s name, student name, and description of the program Program compiles 1 Program does not have any error Program executes 2 Program runs without any error Use JOptionPane 8 Use JOptionPane for input and output Compute conversion 8 Uses logic and correct formula to compute results

Comments

Content

In this lab, you will create two programs that use classes and methods. Deliverables Program files for the following program 1.StudentGPAInfo 2.CurrencyConversion At the beginning of all your programs, put a comment box that includes the program name, your name, and a brief description of the program. Example: /*********************************************************************** Program Name: ProgramName.java Programmer’s Name: Student Name Program Description: Describe here what this program will do ***********************************************************************/ How to submit your assignment: 1.The programs must have the same names as the assignment title. 2.Each Java source file (*.java) must include a corresponding class file (*.class) program as evidence of success. 3.In addition to the program source code files and byte code files, put all your program source code files and screen shots of your program output files into a Word document. 4.You must use a zipped folder to send your weekly assignment to the Dropbox. Do not send subfolders within your zipped folder. Place all of the .java and .class files for the week into the one zipped folder. The zip folder should be named CIS355A_YourLastName_iLab_Week2, and this zip folder will contain all the weekly programming assignments. Step 1: StudentGPAInfo (20 points) Create a class called StudentGPAInfo.java that contains one double-precision instance variables named gpa. It should also contain two integer instance variables named totalgradepoints and numberofclasses. Finally, there should be one instance variable named studentname of string type. The class should include a constructor that initializes the name, numberof classes, and totalgradepoints variables, as well as a default constructor. Also, you need an instance method named calculateGPA() that calculates the student’s grade point average by using this formula: totalgradepoints divided by numberofclasses. Also, you need an instance method. Create one set method that will assign values to the studentname, totalgradepoints, and numberofclasses variables. Create a displayStudent method that will display all of the attributes of the StudentGPAInfo object. Display the GPA with an accuracy of two decimal places (i.e., 3.25). Write a class called GPATest.java. Create one StudentGPAInfo object named student1 using constructor that allows you to pass values to the object. Pass any values you would like to use. Create another StudentGPAInfo object named student2 using the default constructor. Using the set method, assign values to the student2 object. Next, use the calculateGPA() methods on both objects, then invoke the displayStudent() method on each of the objects. Grading Rubric StudentGPAInfo Points Description Standard header included 1 Must contain program’s name, student name, and description of the program Program compiles 2 Program does not have any error Program executes 2 Program runs without any error Created StudentGPAInfo class 3 Program contains the StudentGPAInfo class Constructor created that initializes variables 2 A constructor method exists in the StudentGPAInfo Contains all other methods 2 Set, calculateGPA, and display methods GPATest class, which drives the application, is created 4 A driver class with the main method Correct output is displayed 4 Program displays the name, total points, total classes, and GPA for both objects Subtotal 20 STEP 2: CurrencyConversion (20 points You must create a program named CurrencyConversion.java that converts money between the following currencies. Given one of the three currencies, the program should convert the input amount into one of the other currencies. For example, if you input one (1) U.S. dollar, and you decide to convert that one dollar to a pound, then the output should be .60. Using the JOptionPane GUI, do the following. Prompt the user for the currency code type. Prompt the user for the currency code that the entered amount must be converted to. Using the table above, the following formula was used to convert USD to JPY. 10.00 * 103.73 = 1,037.30 Display the results in a JOptionPane message box. CurrencyConversion Points Description Standard header included 1 Must contain program’s name, student name, and description of the program Program compiles 1 Program does not have any error Program executes 2 Program runs without any error Use JOptionPane 8 Use JOptionPane for input and output Compute conversion 8 Uses logic and correct formula to compute results

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close