A class, PizzaPrice, is provided on the Netbeans project in the package vut.data.Q1. The class stores...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A class, PizzaPrice, is provided on the Netbeans project in the package vut.data.Q1. The class stores the name of a pizza and 3 prices, the price of a small pizza, the price of a medium sized pizza and the price of a large pizza. The class has a constructor that passes as parameters the name and the price of a small pizza only. The price of a medium pizza is 60% more than the price of a small pizza and the price of a large pizza is 90% more than the price of a small pizza. Code all the mutator methods to only accept/assign a price when it is greater than zero. Code the setMediumPPrice method to calculate and assign the price of a medium pizza accordingly. Code the setLarge PPrice method to calculate and assign the price of a large pizza accordingly. The setMediumPPrice and setLarge PPrice must round off the price to 2 decimal places before assigning it to the instance variables (use the Math.round() method to round off the price. 2 Use the JUnit testing Framework, to verify if your setMediumPPrice and setLargePPrice methods are functioning correctly. Code the following methods: Code a test method testSetMediumPPrice 1750 that create an object using the parameter values Four Seasons and 17.50. Call the set Medium PPrice() mutator code the assertEquals() method to check if the prize of a medium pizza is calculated and assigned to the instance variable correctly. Code a test method testSet Medium PPrice Neg1750 that create an object using parameter values Four Seasons and 17.50. Call the setMediumPPrice () mutator with negative small pizza price o code the assertEquals() method to check if the price of a medium pizza will be calculated and assigned to the instance variable. Code a test method testSet Large PPrice 1750 that create an object using the parameter values Four Seasons and 17.50). Call the setLargePPrice () mutator code the assertEquals() method to check if the price of a large pizza is calculated and assigned to the instance variable correctly. O 3 A 3-tier design application with Problem domain, Data Access and GUI classes is required that allows the user to view and manipulate information about Aloe Vera products stored in a MySQL database by clicking on various buttons. Follow the following steps to create the application: 1. Create tblProducts in the database Test1ProductsDB using the product script provided in the NetBeans Project. The table should look like the one shown in Figure 1 ProdCode | ProdName 1001 *Aloe Vera Gel 1002 1003 1004 1005 Forever Garcinia Plus *Aloe Berry Nectar Forever Beta Care Forever Bee Pollen 1006 Forever Bee Propolis 1007 | *Aloe Blossom 1008 | Forever Lite Vanilla ProdCategory | No_In_Stock | Price | WEIGHT MANAGEMENT | WEIGHT MANAGEMENT | NUTRITIONAL_SUPPLEMENT | NUTRITIONAL_SUPPLEMENT | NUTRITIONAL_SUPPLEMENT | NUTRITIONAL_SUPPLEMENT | NUTRITIONAL_SUPPLEMENT WEIGHT_MANAGEMENT 0 19 21 | 33 2 32 6 86 388 226 360 300 | 326 96 426 Figure 1 2. Coding the ProductPD class The class declares the name, code, price, quantity and the category of the product as attributes. The category is stored as an enum type. The class is partly done and is stored in the vut.data package. Check if all the attributes, getters and setters have been declared correctly and if not, code the missing parts of the dass to completion. Also code the toString method to display as in Figure 4. Include two overloaded constructors: o The first constructor should pass as parameters the product name, category, quantity, and price in that order. This constructor will be used to add user input to the database. o The second constructor should pass the product code, product name, category, quantity, and price in that order. This constructor will be used to store data from the database. 4 LO 5 3. Coding the ProductDA class Code the following methods in the DA class: initialise()- the method will be used to connect to the java application to the database. viewAll()- the method will be used to access and return all the rows of tblProducts. viewOutofStockItems() - the method will be used to access and return all the columns of the products that are depleted. replenish (quantity, product code)- the method passes as parameters the quantity and the product code. The method will be used to replenish any product of a given code by a given quantity. addProduct (prod Obj)- the methodpasses as a parameter an object of the productPD class. It will be used to add a new product to tblProducts. Be sure to call these methods in the PD class. 4. GUI - Product Management Form Class The application consists of the GUI shown in Figure 2 Product Sale Application Prod Code: Prod Name: Prod Price: Quantity: Stock Value: Add Product Product Category WEIGHT MANAGEMENT NUTRITIONAL SUPPLEMENT Previous Next Replenish Out of Stock Add Product Clear Form Process 0 Figure 2 5 6 Some class level variables have been declared: The class level array list items will be used to store objects returned by the viewAll method of the DA class. The integer k will be used as an index to access the objects of the items array list. 5. Code the Product ManagementForm class as follows: Be sure the radio buttons are grouped. Hide the AddProduct panel when this form is first loaded The connection to the database should be established when the form first loads. The displayOnTextFields() method will be used to display in the text fields, the products returned by the viewAll as in Figure 3. Code it as follows: . O Assign the data returned by the viewAll method onto the items arraylist Make use of the class level integer k to display the data in the text fields as shown in Figure 3 The first product in the array list must be displayed in the text fields when the form first loads, so call the display On TextFields method in the constructor of the form. Prod Code: Prod Name: Prod Price: Quantity: Stock Value: . O 1002 Forever Garcinia Plus $388.00 19 $7,372.00 Previous Next Replenish Out of Stock Add Product Figure 3 Button Next- when clicked, the button increases the value of the integer k by 1 if this increment will not go beyond the maximum index of the array list. So it checks, increases and displays the next product of the items array list in the text fields. Otherwise it displays the message that the end of the array list has been reached. Button Previous- The button displays the products in the array list going backwards. That is, if the position of the product currently displayed is 4, when it is clicked again it will display position 3. So when clicked, the 6 7 . button decreases the value of the integer k by 1 if this decrement will not go beyond the lowest index of the array list. So it checks, decreases and displays the previous product of the items array list in the text fields. Otherwise it displays the message that the beginning of the array list has been reached. Button Replenish- the button prompts the user to enter the product code of the product to be replenished and the number of items or quantity to increase the product by and then calls the replenish method. Use input boxes for prompting the user to enter the product number and the quantity. Button Out of Stock - the button calls the viewOutofStockItems() method to display on the text area all the products that are depleted. Use the toString method of the PD dass to display as in Figure 4. Button Add Product - when clicked, the button displays the addProduct panel, clears the controls, and makes the product code and stock value text fields uneditable. Button Process the button will be used to add a new product to the database. When clicked, it checks if any of the radio buttons is selected or not, if none of the radio buttons is selected it indicates that to the user using a message box (see Figure 4) and stops processing immediately. If a radio button is selected, it assigns the text property of the radio button to a string variable prodCategory and then, Get the other input values from the controls 0 Create a product object o Call the add Product method to add the object to the database, dear the controls and Call the displayOn Textboxes method. 0 0 0 1001#*Aloe Vera Gel#86.0#0#WEIGHT_MANAGEMENT 1004#Forever Beta Care#360.0#0#NUTRITIONAL_SUPPLEMENT Button Clear- clears the controls Figure 4 ERROR indicate the category as wel X OK Figure 5 7 A class, PizzaPrice, is provided on the Netbeans project in the package vut.data.Q1. The class stores the name of a pizza and 3 prices, the price of a small pizza, the price of a medium sized pizza and the price of a large pizza. The class has a constructor that passes as parameters the name and the price of a small pizza only. The price of a medium pizza is 60% more than the price of a small pizza and the price of a large pizza is 90% more than the price of a small pizza. Code all the mutator methods to only accept/assign a price when it is greater than zero. Code the setMediumPPrice method to calculate and assign the price of a medium pizza accordingly. Code the setLarge PPrice method to calculate and assign the price of a large pizza accordingly. The setMediumPPrice and setLarge PPrice must round off the price to 2 decimal places before assigning it to the instance variables (use the Math.round() method to round off the price. 2 Use the JUnit testing Framework, to verify if your setMediumPPrice and setLargePPrice methods are functioning correctly. Code the following methods: Code a test method testSetMediumPPrice 1750 that create an object using the parameter values Four Seasons and 17.50. Call the set Medium PPrice() mutator code the assertEquals() method to check if the prize of a medium pizza is calculated and assigned to the instance variable correctly. Code a test method testSet Medium PPrice Neg1750 that create an object using parameter values Four Seasons and 17.50. Call the setMediumPPrice () mutator with negative small pizza price o code the assertEquals() method to check if the price of a medium pizza will be calculated and assigned to the instance variable. Code a test method testSet Large PPrice 1750 that create an object using the parameter values Four Seasons and 17.50). Call the setLargePPrice () mutator code the assertEquals() method to check if the price of a large pizza is calculated and assigned to the instance variable correctly. O 3 A 3-tier design application with Problem domain, Data Access and GUI classes is required that allows the user to view and manipulate information about Aloe Vera products stored in a MySQL database by clicking on various buttons. Follow the following steps to create the application: 1. Create tblProducts in the database Test1ProductsDB using the product script provided in the NetBeans Project. The table should look like the one shown in Figure 1 ProdCode | ProdName 1001 *Aloe Vera Gel 1002 1003 1004 1005 Forever Garcinia Plus *Aloe Berry Nectar Forever Beta Care Forever Bee Pollen 1006 Forever Bee Propolis 1007 | *Aloe Blossom 1008 | Forever Lite Vanilla ProdCategory | No_In_Stock | Price | WEIGHT MANAGEMENT | WEIGHT MANAGEMENT | NUTRITIONAL_SUPPLEMENT | NUTRITIONAL_SUPPLEMENT | NUTRITIONAL_SUPPLEMENT | NUTRITIONAL_SUPPLEMENT | NUTRITIONAL_SUPPLEMENT WEIGHT_MANAGEMENT 0 19 21 | 33 2 32 6 86 388 226 360 300 | 326 96 426 Figure 1 2. Coding the ProductPD class The class declares the name, code, price, quantity and the category of the product as attributes. The category is stored as an enum type. The class is partly done and is stored in the vut.data package. Check if all the attributes, getters and setters have been declared correctly and if not, code the missing parts of the dass to completion. Also code the toString method to display as in Figure 4. Include two overloaded constructors: o The first constructor should pass as parameters the product name, category, quantity, and price in that order. This constructor will be used to add user input to the database. o The second constructor should pass the product code, product name, category, quantity, and price in that order. This constructor will be used to store data from the database. 4 LO 5 3. Coding the ProductDA class Code the following methods in the DA class: initialise()- the method will be used to connect to the java application to the database. viewAll()- the method will be used to access and return all the rows of tblProducts. viewOutofStockItems() - the method will be used to access and return all the columns of the products that are depleted. replenish (quantity, product code)- the method passes as parameters the quantity and the product code. The method will be used to replenish any product of a given code by a given quantity. addProduct (prod Obj)- the methodpasses as a parameter an object of the productPD class. It will be used to add a new product to tblProducts. Be sure to call these methods in the PD class. 4. GUI - Product Management Form Class The application consists of the GUI shown in Figure 2 Product Sale Application Prod Code: Prod Name: Prod Price: Quantity: Stock Value: Add Product Product Category WEIGHT MANAGEMENT NUTRITIONAL SUPPLEMENT Previous Next Replenish Out of Stock Add Product Clear Form Process 0 Figure 2 5 6 Some class level variables have been declared: The class level array list items will be used to store objects returned by the viewAll method of the DA class. The integer k will be used as an index to access the objects of the items array list. 5. Code the Product ManagementForm class as follows: Be sure the radio buttons are grouped. Hide the AddProduct panel when this form is first loaded The connection to the database should be established when the form first loads. The displayOnTextFields() method will be used to display in the text fields, the products returned by the viewAll as in Figure 3. Code it as follows: . O Assign the data returned by the viewAll method onto the items arraylist Make use of the class level integer k to display the data in the text fields as shown in Figure 3 The first product in the array list must be displayed in the text fields when the form first loads, so call the display On TextFields method in the constructor of the form. Prod Code: Prod Name: Prod Price: Quantity: Stock Value: . O 1002 Forever Garcinia Plus $388.00 19 $7,372.00 Previous Next Replenish Out of Stock Add Product Figure 3 Button Next- when clicked, the button increases the value of the integer k by 1 if this increment will not go beyond the maximum index of the array list. So it checks, increases and displays the next product of the items array list in the text fields. Otherwise it displays the message that the end of the array list has been reached. Button Previous- The button displays the products in the array list going backwards. That is, if the position of the product currently displayed is 4, when it is clicked again it will display position 3. So when clicked, the 6 7 . button decreases the value of the integer k by 1 if this decrement will not go beyond the lowest index of the array list. So it checks, decreases and displays the previous product of the items array list in the text fields. Otherwise it displays the message that the beginning of the array list has been reached. Button Replenish- the button prompts the user to enter the product code of the product to be replenished and the number of items or quantity to increase the product by and then calls the replenish method. Use input boxes for prompting the user to enter the product number and the quantity. Button Out of Stock - the button calls the viewOutofStockItems() method to display on the text area all the products that are depleted. Use the toString method of the PD dass to display as in Figure 4. Button Add Product - when clicked, the button displays the addProduct panel, clears the controls, and makes the product code and stock value text fields uneditable. Button Process the button will be used to add a new product to the database. When clicked, it checks if any of the radio buttons is selected or not, if none of the radio buttons is selected it indicates that to the user using a message box (see Figure 4) and stops processing immediately. If a radio button is selected, it assigns the text property of the radio button to a string variable prodCategory and then, Get the other input values from the controls 0 Create a product object o Call the add Product method to add the object to the database, dear the controls and Call the displayOn Textboxes method. 0 0 0 1001#*Aloe Vera Gel#86.0#0#WEIGHT_MANAGEMENT 1004#Forever Beta Care#360.0#0#NUTRITIONAL_SUPPLEMENT Button Clear- clears the controls Figure 4 ERROR indicate the category as wel X OK Figure 5 7
Expert Answer:
Related Book For
Financial Reporting Financial Statement Analysis and Valuation a strategic perspective
ISBN: 978-1285190907
8th edition
Authors: James M. Wahlen, Stephen P. Baginski, Mark Bradshaw
Posted Date:
Students also viewed these programming questions
-
Consider a dataset of 50 observations of a response variable y and a predictor variable x. A simple linear regression model results in a sample slope estimate b1 = 0.9574 with standard error se(b1) =...
-
123 Compare the purely graphical properties of these two notations, and the ways in which the graphical properties of each display correspond to the information structure being defined. Describe...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Mario and Kaitlin are married and file a joint tax return. They have adjusted gross income of $385,000 that includes $4,700 of investment income ($3,000 short-term capital gains and $1,700 of...
-
The table below lists the volume of nonfederal student loans, in billions of dollars, represented in terms of the number of years since 2004. Year, x Volume of student Loans (in billions) 2004, 0...
-
The average length of a flight by regional airlines in the United States has been reported as 299 miles. If a simple random sample of 30 flights by regional airlines were to have x =314.6 miles and s...
-
Which is not one of the three forms of business organization? (a) Sole proprietorship. (c) Partnership. (b) Creditorship. (d) Corporation.
-
1. Would you describe Starbucks production/operations technology in its retail stores as unit, mass, or process? Explain your choice. How does its production/operations technology approach affect the...
-
for each of the following number series, study their Convergence or divergence, By specifying the criterion used. Give all the details of your approach . n a ) 5 n( Inn ) 12 312 n: 2 +
-
Wild Things, a zoo management company, has asked your team to evaluate a proposed capital budgeting project. Your team has been charged with analyzing the Creature Gauge, an artificial intelligence...
-
Implement a simple .NET desktop application (i.e., Windows Form, WPF, UWP) that executes four tasks synchronously and asynchronously. In the GUI's top left, you can enter integers. Click Start...
-
Integration - Fundamental Theorem variable bounds: Problem 13 (1 point) Find the set on which the curve is concave downward. Answer (in interval notation): I y = S 7 dt t2 +8t+17
-
A partnership begins its first year of operations with the following capital balances: Allegan, Capital Berrien, Capital Kent, Capital $ 58,000 48,000 58,000 According to the articles of partnership,...
-
You drop an object from a bridge and simultaneously, you throw a-other object downwards at 10 m/s. As the objects are falling, which object has the larger acceleration? (Ignore air resistance.) O The...
-
Jensen Machinery Company manufactures and sells or leases various types of farming equipment. On 1/1/23, Jensen leased a large plowing system to O'Brien Farms. Data relating to the lease follow: Cost...
-
Oriole Company is preparing its direct labor budget for May. Projections for the month are that 39400 units are to be produced and that direct labor time is three hours per unit. If the labor cost...
-
Express these numbers in standard notation. a. 2.87 10-8 b. 1.78 1011 c. 1.381 10-23
-
Exhibit 7.19 summarizes the information disclosed by a large conglomerate regarding its stock option plans for Years 2-4. Assume an income tax rate of 35%. Required a. The average option price per...
-
On January 1, 2014, assume that Turner Construction Company agreed to construct an observatory for Dartmouth College for $120 million. Dartmouth College must pay $30 million upon signing and $30...
-
Select data for Avis and Hertz for 2012 follow. Based only on this information and ratios that you construct, speculate on similarities and differences in the operations and financing decisions of...
-
Defective units decision analysis Claymore Manufacturing Company produces auto- mobile stereo systems in job lots. Production errors occasionally occur, and defective units are reworked if it can be...
-
Accounting for scrap materials Alger Company generates copper scrap in its coil man- ufacturing department. The scrap is gathered and weighed at the end of each work day and sent to the scrap...
-
Using scrap materials accounting information FLC Corporation manufactures wooden picnic tables which are sold to department stores and garden stores. Recently the company accepted an offer to make...
Study smarter with the SolutionInn App