CIS 220 Week 5 Assignment. Please complete all the questions and paste your codes to this document. Also submit all the source code files along with this assignment. 1-a) Design a blueprint class that records the payments and purchases made in a Customer Account of an online shop. For now we will model only these two instance variables, although a real world customer account will have many more data to store and track. (90pts) We will name the class called Customer Account. The requirements (for this problem) are as follows: a) The class/object model will keep track of payments and purchases, both of which can be of type double. To do this, have the two instance variables called payment and purchase. b) The class/object model will provide the values of the payments and purchases to the client program. To do this, have proper getters for the instance variables c) The class/object model has method, recordPayment, that will record payments. To do this the method will receive the amount as a parameter and add this amount to the payments. Write a method in the class that will take in an input parameter called amount to add to payment. This method has a void return. d) The class/object model has method, recordPurchases, that will record purchases. To do this the method will receive the amount as a parameter, and add this amount to the purchases. Write a method in the class that will take in an input parameter called amount to add to purchase. This method has a vold return. e) The class/object model has a method called printBalance that will print the balance. The value of balance is given by the difference between payments and purchases. The printBalance method takes in no input parameters and has a void return. Format the print output and show the purchase and payment amounts as well. 1) The class/ object model has constructors that will allow default and full-argument overloaded constructors in the client class. Write appropriate default and overloaded constructors. Default values of payment and purchases are set to zero. To do: 1.a)Identity and write all the requirements of the Customer Account class on the worksheet shown below 22pts 1 2.b)Then, write the class code for Customer Account class in Java, that meets all the requirements from the previous step. Make sure your code is error free. 22pts 2.c)Test all the requirements using the test plan requirements given below. Write and submit the code of the Test Customer Account class. 26pts 1-a) Requirements table: complete the tables shown below for the Customer Account class: (22 pts for completing this table and 22 pts for the code in Customer Account.java file) Instance variables: 2 pts for each row Instance variables ACONS Data Types Sample Value Instance methods (including getters and setters) (2 pts each row) Instance Access modifier Return data Parameters name Argument methods of the method type and type (list all of values for the name them for a parameter method) give a sample value for each parameter Constructors (2 pts each row) Constructor Access name modifier Parameters name and type it all of them for a method) 1-b) Create a class called Customer Account.java that will meet all the requirements identified in the tables above. (22 pts) 1-c) Create a class called TestCustomer Account in the same package that you created Customer Account class. The requirements for TestCustomer Account class is 2 as given below. Create a main method and write the code for main method as given below: ( 26 pts for the code that meets all the test requirements shown below) Class Action Test results elements 1 Default Create a product object Object prod 1 should be created constructor - custAcct 1 using default without errors (2 pts) constructor 2 Full-arg Create a product object Object prod2 should be created constructor - custAcct 2 using full-arg without errors (2 pts) constructor. Supply appropriate data for purchase and payment by obtaining (scanning) these values from the user 3 All getters - Print the return values of the All the printed values of (4pts) two getters for custAcct1 instance variables should have the default values specified in the constructor 4 All getters Print the return values of all All the printed values of (4 pts) getters for custAcct2 Instance variables should have the values specified as parameter in the full-arg constructor 5 All the setters - Change all the instance Next step will test if the setters (4 pts) variables of custAcct1 using are setting proper values setters. Obtain the values to be set for payment and purchase from the user 6 All getters Print the return values of all All the printed values of (2 pts) getters for custAcct1 instance variables should now have the values specified using the setters in step 5 7 Method: Call record Payment for Print the value of the the recordPayment custAcc1. Supply an amount getPayment method for -(4 pts) of 50 (no need to obtain this custAcct to see if the payment value from the user) has been updated by 50 Method: Call record Purchase for Print the value of the the recordPurchase custAcc1. Supply an amount getPurchase() method for -(4 pts) of 20 (no need to obtain this custAcc1 to see if the purchase value from the user) has been updated by 20 9 Method: Call printBalance for Check to see if balance printed printBalance - custAcc1. is 30 (which is 50-20) (2 pts) 8 Copy/paste the code for Customer Account and TestCustomer Account classes here. Also provide a screen shot of the results. The outputs should be formatted such that each out put line should describe what is the output stands for. Submit the java as well. Problem 2: You may create a separate(new) package to write the Product and TestProduct classes of problems 3. (100 pts) Product class requirements narrative 1) Write a class that will model a Product in a store. We are interested in developing an application that will keep track of every Product in a certain store. The properties of a Product that needs to be captured (at the minimum) in a Product class are producti, productName, product Manufacturer, productPrice, productCategory which could be defined as int, String, String, double and int respectively. Whenever the data entry clerk enters a new product's data into the system, that data is captured by an application such that creates a new Product object and populates its instance variable with the new data. These instance variables/product data should be kept secure from tampering and hence, the class will need to encapsulate these data and define the instance variables as private. There could be several client programs that should be capable of manipulating the datalinstance variables of a given product object. The client programs will access and change those instance variable using appropriate getters and setters. Therefore, the product class should define appropriate getters and setters that the client programs can use. The product class also needs constructors, both default and full-argument overloaded ones so that client programs have the option of using one of these constructors based the programs needs. For example, either of the constructors could be used to create a new product object. If the data entry clerk has data for all the instance variables of a new product, they can use the full-arg constructor to create a new product by entering the data as arguments of the constructors. If the data entry clerk does not have all the data of the new product at hand they can still a new product object using the default constructor and then use the getters and setters to change the data stored in the instance variables later on The product class needs to have a method that will calculate and return the list price of the product. The list price is different from productPrice. The list price includes a product discount that might be applied to the productPrice. The method called calculateListPrice takes in a discount value as a parameter. The calculateListPrice returns the value of the listPrice. Both, the discount value and listPrice are doubles, listPrice is calculated as productPrice"(1-discount) To do: 2.a)ldentity and write all the requirements of the Product class on the worksheet shown below-36pts 2.b)Then, write the class code for Product class in Java, that meets all the requirements from the previous step. Make sure your code is error free.. 36pts 2.c)Test all the requirements using the test plan requirements given below. Write and submit the code of the TestProduct class. -28 pts 2.a) Class Requirements table worksheets: Class name: Product Instance variables (2 pts each) Instance variables Access modifier Data Types Sample Value Instance Methods including getters and setters) - add more rows as needed (2 pts each) # Instance Access modifier Return data Parameters name Argument methods of the method type and type list all of values for the name them for a parameter, method) give a sample value for each parameter 5 Constructor(s) 2 pts each Constructor namo Access modifier Parameters name and type (list all of them for a method) 2.b) Please write the Product class in java. 2.c) Please write the TestProduct class by writing the code in the following order shown in the test plan. Test Plan Template for TestProduct class (28 pts) Class elements Action Test results 1 Default constructor- (2 pts) Full-arg constructor - (2 pts) 2 3 All gotters - (5pts) 4 All getters - (5 pts) Create a product object Object prod 1 should be prod1 using default created without errors constructor Create a product object Object prod2 should be prod 2 using full-arg created without errors constructor. Supply appropriate data as arguments Print the return values of all All the printed values of getters for prod1 instance variables should have the default values specified in the constructor Print the return values of all All the printed values of getters for prod 2 instance variables should have the values specified as parameter in the full-arg constructor Change all the instance Next step will test if the setters variables of prod1 using are setting proper values setters. Obtain the values of the setter's arguments for setting he instance variables, from the user one by one Print the return values of all All the printed values of getters for prod1 instance variables should now have the values specified using the setters in step 5 5 All the setters - (5 pts) 6 All getters - (5 pts) Print the value of the captured return double variable. Method: Call calculateListPrice for calculateListPrice prod1. Supply a discount -(4 pts) value of 0.3.(no need to obtain this value from the user) Capture the return of the method in a double variable Paste your code for Product and TestProduct here. Also submit the .java files for both classes. CIS 220 Week 5 Assignment. Please complete all the questions and paste your codes to this document. Also submit all the source code files along with this assignment. 1-a) Design a blueprint class that records the payments and purchases made in a Customer Account of an online shop. For now we will model only these two instance variables, although a real world customer account will have many more data to store and track. (90pts) We will name the class called Customer Account. The requirements (for this problem) are as follows: a) The class/object model will keep track of payments and purchases, both of which can be of type double. To do this, have the two instance variables called payment and purchase. b) The class/object model will provide the values of the payments and purchases to the client program. To do this, have proper getters for the instance variables c) The class/object model has method, recordPayment, that will record payments. To do this the method will receive the amount as a parameter and add this amount to the payments. Write a method in the class that will take in an input parameter called amount to add to payment. This method has a void return. d) The class/object model has method, recordPurchases, that will record purchases. To do this the method will receive the amount as a parameter, and add this amount to the purchases. Write a method in the class that will take in an input parameter called amount to add to purchase. This method has a vold return. e) The class/object model has a method called printBalance that will print the balance. The value of balance is given by the difference between payments and purchases. The printBalance method takes in no input parameters and has a void return. Format the print output and show the purchase and payment amounts as well. 1) The class/ object model has constructors that will allow default and full-argument overloaded constructors in the client class. Write appropriate default and overloaded constructors. Default values of payment and purchases are set to zero. To do: 1.a)Identity and write all the requirements of the Customer Account class on the worksheet shown below 22pts 1 2.b)Then, write the class code for Customer Account class in Java, that meets all the requirements from the previous step. Make sure your code is error free. 22pts 2.c)Test all the requirements using the test plan requirements given below. Write and submit the code of the Test Customer Account class. 26pts 1-a) Requirements table: complete the tables shown below for the Customer Account class: (22 pts for completing this table and 22 pts for the code in Customer Account.java file) Instance variables: 2 pts for each row Instance variables ACONS Data Types Sample Value Instance methods (including getters and setters) (2 pts each row) Instance Access modifier Return data Parameters name Argument methods of the method type and type (list all of values for the name them for a parameter method) give a sample value for each parameter Constructors (2 pts each row) Constructor Access name modifier Parameters name and type it all of them for a method) 1-b) Create a class called Customer Account.java that will meet all the requirements identified in the tables above. (22 pts) 1-c) Create a class called TestCustomer Account in the same package that you created Customer Account class. The requirements for TestCustomer Account class is 2 as given below. Create a main method and write the code for main method as given below: ( 26 pts for the code that meets all the test requirements shown below) Class Action Test results elements 1 Default Create a product object Object prod 1 should be created constructor - custAcct 1 using default without errors (2 pts) constructor 2 Full-arg Create a product object Object prod2 should be created constructor - custAcct 2 using full-arg without errors (2 pts) constructor. Supply appropriate data for purchase and payment by obtaining (scanning) these values from the user 3 All getters - Print the return values of the All the printed values of (4pts) two getters for custAcct1 instance variables should have the default values specified in the constructor 4 All getters Print the return values of all All the printed values of (4 pts) getters for custAcct2 Instance variables should have the values specified as parameter in the full-arg constructor 5 All the setters - Change all the instance Next step will test if the setters (4 pts) variables of custAcct1 using are setting proper values setters. Obtain the values to be set for payment and purchase from the user 6 All getters Print the return values of all All the printed values of (2 pts) getters for custAcct1 instance variables should now have the values specified using the setters in step 5 7 Method: Call record Payment for Print the value of the the recordPayment custAcc1. Supply an amount getPayment method for -(4 pts) of 50 (no need to obtain this custAcct to see if the payment value from the user) has been updated by 50 Method: Call record Purchase for Print the value of the the recordPurchase custAcc1. Supply an amount getPurchase() method for -(4 pts) of 20 (no need to obtain this custAcc1 to see if the purchase value from the user) has been updated by 20 9 Method: Call printBalance for Check to see if balance printed printBalance - custAcc1. is 30 (which is 50-20) (2 pts) 8 Copy/paste the code for Customer Account and TestCustomer Account classes here. Also provide a screen shot of the results. The outputs should be formatted such that each out put line should describe what is the output stands for. Submit the java as well. Problem 2: You may create a separate(new) package to write the Product and TestProduct classes of problems 3. (100 pts) Product class requirements narrative 1) Write a class that will model a Product in a store. We are interested in developing an application that will keep track of every Product in a certain store. The properties of a Product that needs to be captured (at the minimum) in a Product class are producti, productName, product Manufacturer, productPrice, productCategory which could be defined as int, String, String, double and int respectively. Whenever the data entry clerk enters a new product's data into the system, that data is captured by an application such that creates a new Product object and populates its instance variable with the new data. These instance variables/product data should be kept secure from tampering and hence, the class will need to encapsulate these data and define the instance variables as private. There could be several client programs that should be capable of manipulating the datalinstance variables of a given product object. The client programs will access and change those instance variable using appropriate getters and setters. Therefore, the product class should define appropriate getters and setters that the client programs can use. The product class also needs constructors, both default and full-argument overloaded ones so that client programs have the option of using one of these constructors based the programs needs. For example, either of the constructors could be used to create a new product object. If the data entry clerk has data for all the instance variables of a new product, they can use the full-arg constructor to create a new product by entering the data as arguments of the constructors. If the data entry clerk does not have all the data of the new product at hand they can still a new product object using the default constructor and then use the getters and setters to change the data stored in the instance variables later on The product class needs to have a method that will calculate and return the list price of the product. The list price is different from productPrice. The list price includes a product discount that might be applied to the productPrice. The method called calculateListPrice takes in a discount value as a parameter. The calculateListPrice returns the value of the listPrice. Both, the discount value and listPrice are doubles, listPrice is calculated as productPrice"(1-discount) To do: 2.a)ldentity and write all the requirements of the Product class on the worksheet shown below-36pts 2.b)Then, write the class code for Product class in Java, that meets all the requirements from the previous step. Make sure your code is error free.. 36pts 2.c)Test all the requirements using the test plan requirements given below. Write and submit the code of the TestProduct class. -28 pts 2.a) Class Requirements table worksheets: Class name: Product Instance variables (2 pts each) Instance variables Access modifier Data Types Sample Value Instance Methods including getters and setters) - add more rows as needed (2 pts each) # Instance Access modifier Return data Parameters name Argument methods of the method type and type list all of values for the name them for a parameter, method) give a sample value for each parameter 5 Constructor(s) 2 pts each Constructor namo Access modifier Parameters name and type (list all of them for a method) 2.b) Please write the Product class in java. 2.c) Please write the TestProduct class by writing the code in the following order shown in the test plan. Test Plan Template for TestProduct class (28 pts) Class elements Action Test results 1 Default constructor- (2 pts) Full-arg constructor - (2 pts) 2 3 All gotters - (5pts) 4 All getters - (5 pts) Create a product object Object prod 1 should be prod1 using default created without errors constructor Create a product object Object prod2 should be prod 2 using full-arg created without errors constructor. Supply appropriate data as arguments Print the return values of all All the printed values of getters for prod1 instance variables should have the default values specified in the constructor Print the return values of all All the printed values of getters for prod 2 instance variables should have the values specified as parameter in the full-arg constructor Change all the instance Next step will test if the setters variables of prod1 using are setting proper values setters. Obtain the values of the setter's arguments for setting he instance variables, from the user one by one Print the return values of all All the printed values of getters for prod1 instance variables should now have the values specified using the setters in step 5 5 All the setters - (5 pts) 6 All getters - (5 pts) Print the value of the captured return double variable. Method: Call calculateListPrice for calculateListPrice prod1. Supply a discount -(4 pts) value of 0.3.(no need to obtain this value from the user) Capture the return of the method in a double variable Paste your code for Product and TestProduct here. Also submit the .java files for both classes