Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coding in Java I want the code for the basket class and customer class. ll ROGERS 7:13 PM * 36%) ill.ca 40 points Write a

Coding in Java I want the code for the basket class and customer class.
image text in transcribed
image text in transcribed
ll ROGERS 7:13 PM * 36%) ill.ca 40 points Write a class Basket which has the following private field: An srray of MarketProducts The elass mst also have the following publie methods: A constractor that takes no inputa and initialize the field with an empty array. . A gotProductsO method which takes no inputs and returas a shailow copy of the array NOT a copy of the rederence!) of KarketProducts of this Basket (with the elements in the same order). * An add() method which takes-s input a MarketProduct and does not return any value. The method adds the MarketProduct at the end of the list of prodacts of this Basket A reaove) method whch takes ss input a MarketProduct and retarns a boolean. The method removes the first occurrence of the specified element from the array of products of this Basket. If no such product excists, then the method returts false, otherwise, after removing it, the method returns true. Note that this method removes a product from the list if and only if such product is equal to the input received. For example, it is not possible to remove 0.25 Kg o Melntosh apples for a 0.5 Kg Mclntosh apples MarketProduct After the product has been remove from the srray, the subsequent elements should be shifted dowa by one position, leaving no empty sot in the array eA clearO method which takes so inputs, returns no values, aad empties the aray of products of this Basket A getNunOfProducts present in this Basket method that takes no inputs and returns the number of products A getSubTotal method thst takes no inpats and returns the coet (in ceats) of all the products in this Basket . A getTotalTax) method that takes no inputs and returns the tax amount (in cents to be paid based on the product in this Basket. Since we are in Quebec, you ean use atax rate of 15%. The tax an ount should be rounded down to the nearest cent. Note that Egg and Fruit are tax free, so taxes should be paid only for Jan A gatTotalCoat) method that takes no inputs and returns the total cost (in cents and after tax) of the products in this Basket . A toString) method that returns a String representing a recelpt for this Basket. The receipt shoald cootain a product per line. On each line the name of the product should appear, followed by its price separated by a tab character. After all the products have been listed, the following information should appear on each line - An empty line - The subtotal cost - The total tax - An empty line - The total cost ll ROGERS 7:13 PM * 36%) ill.ca 40 points Write a class Basket which has the following private field: An srray of MarketProducts The elass mst also have the following publie methods: A constractor that takes no inputa and initialize the field with an empty array. . A gotProductsO method which takes no inputs and returas a shailow copy of the array NOT a copy of the rederence!) of KarketProducts of this Basket (with the elements in the same order). * An add() method which takes-s input a MarketProduct and does not return any value. The method adds the MarketProduct at the end of the list of prodacts of this Basket A reaove) method whch takes ss input a MarketProduct and retarns a boolean. The method removes the first occurrence of the specified element from the array of products of this Basket. If no such product excists, then the method returts false, otherwise, after removing it, the method returns true. Note that this method removes a product from the list if and only if such product is equal to the input received. For example, it is not possible to remove 0.25 Kg o Melntosh apples for a 0.5 Kg Mclntosh apples MarketProduct After the product has been remove from the srray, the subsequent elements should be shifted dowa by one position, leaving no empty sot in the array eA clearO method which takes so inputs, returns no values, aad empties the aray of products of this Basket A getNunOfProducts present in this Basket method that takes no inputs and returns the number of products A getSubTotal method thst takes no inpats and returns the coet (in ceats) of all the products in this Basket . A getTotalTax) method that takes no inputs and returns the tax amount (in cents to be paid based on the product in this Basket. Since we are in Quebec, you ean use atax rate of 15%. The tax an ount should be rounded down to the nearest cent. Note that Egg and Fruit are tax free, so taxes should be paid only for Jan A gatTotalCoat) method that takes no inputs and returns the total cost (in cents and after tax) of the products in this Basket . A toString) method that returns a String representing a recelpt for this Basket. The receipt shoald cootain a product per line. On each line the name of the product should appear, followed by its price separated by a tab character. After all the products have been listed, the following information should appear on each line - An empty line - The subtotal cost - The total tax - An empty line - The total cost

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago