Create a class to represent Fresh Fruit items

Assignment Help JAVA Programming
Reference no: EM132372246

Object Oriented Design and Programming Assignment - Individual Programming Solution to a Problem

Unit Learning Outcomes addressed: Upon successful completion of this unit students should be able to:

a. Analyse and dissect simple design and programming problems.

b. Demonstrate basic knowledge of object oriented programming concepts and syntax.

c. Implement a well-designed modularised solution to small programming problems.

d. Develop and/or implement testing schedules.

ASSESSMENT DESCRIPTION -

Objectives - After completing this assessment, you should have developed skills to demonstrate that you are able to:

  • Write classes that are subclasses of other classes.
  • Write code that overrides behaviour of inherited methods.
  • Write code that exploits the benefits of polymorphism.
  • Observe/apply principles of good object-oriented design.

1. Individual understanding of Object Oriented Programming principles

Write about 500 words to explain what you have learnt in week 9 and week 10. Use appropriate examples to illustrate your understanding.

2. Program

2.1 Background

The classes you write will be to represent a variety of product types available at a supermarket. They will all have a common method to produce a line of output suitable to be included in a docket. However, depending on what type of product it is, this output will contain different sort of information.

For all products, the output line should include:

  • The name of the item
  • The ID of product
  • The price of the item
  • The amount of the price which is a tax-component (explained below)

Depending on the type of product, the following additional information should be output:

  • If it is a Fresh Fruit item, the weight of the item (e.g. the Apple is 100 grams, the watermelon is 1200 grams).
  • If it is a Packaged item, the quantity of units in the package (e.g. 4 eggs in the package, 20 chocolate bars in the bag), and a use-by date.

The tax-component is calculated from the price of the item, and the following rates are used:

  • For Fresh Fruit items, 0%
  • For Packaged items, 10% of the price

2.2 Tasks -

1. Create a class named Product to be the superclass of all products. It should have suitable constructors to aid with polymorphic behaviour, and contain suitable attributes to store the information that is common to all product types (but whose values vary for each instance of that product type), and appropriate accessors. For all products, the toString method should return only the name and ID of the product.

2. Create a class to represent Fresh Fruit items. It should be a subclass of the class made in task 1. Ensure that it contains appropriate attributes to store additional information specific to fresh fruit. Ensure that there is a suitable constructor to set all values appropriately, and that there are appropriate accessors to obtain all information relevant to fresh fruit. Override toString() method so that it return all relevant information to the fresh fruit.

3. Create a class to represent Packaged items. It should be a subclass of the class made in task 1. Ensure that it contains appropriate attributes to store additional information specific to packaged items. Ensure that there is a suitable constructor to set all values appropriately, and that there are appropriate accessors to obtain all information relevant to packaged items. Override toString() method so that it return all relevant information to the Packaged items.

4. Create a driver class which will have main method and following functionalities.

  • Create ten different products and display them on console.
  • Ask user to select the products that they want to buy by selecting the IDs.
  • User can buy multiple products in one purchase.
  • Use proper get methods to find total amount and total tax component.
  • Display the docket which will have information about total amount due and total tax value in purchase.

5. Create a class diagram for above mentioned classes. Show all attributes, methods and proper relationships between classes.

Reference no: EM132372246

Questions Cloud

Evaluate internal controls for its expenditure cycle : Use different methodologies to evaluate accounting information systems - ompany has a centralised accounting system with networked terminals
Discuss topic the value of lenses and metaphors : While it is certainly more than just an organization, without question, the Church definitely is an organization. Additionally, God in His Word gives us several
Explain the role of the teacher and the student : You have researched educational philosophies as well as theorists whose perspectives have affected the early childhood classroom. These views on teaching.
Write definition of formal assessment strategy : Research assessment strategies that include formal, informal, formative, and summative assessments. Based on your findings, create a 12-15 slide presentation.
Create a class to represent Fresh Fruit items : OODP101 Object Oriented Design and Programming Assignment - Individual Programming Solution to a Problem, Kent Institute Australia
How you would apply each strategy to the content areas : Choose five SEI strategies from your required readings. Create a chart or organized list of these strategies with examples of how you would apply each strategy.
Prepare the bank reconciliation for little red riding : Prepare the journal entries to correct any errors made by Little Red Riding, and to record transactions that have not yet been entered into the business
Define spatial and architectural features of familiar places : Describe the spatial and architectural features of familiar places. Apply theoretical principles to the architecture of everyday spaces.
How have religious traditions preserved continuity : How have religious traditions preserved continuity through the ages from their historical origins to the present day? What social and cultural differences make.

Reviews

len2372246

9/18/2019 3:07:52 AM

SUBMISSION: A one or two page design + test data document, your .java and .class files. MARKING GUIDE (RUBRIC): There's a total of 30 marks available. Creation of Product class with all attributes, constructor and methods 5 marks. Constructor overloading in product class to show polymorphic behavior 1.5 marks. Creation of Fresh Fruit class with all attributes, constructor and methods 5 marks. Method overriding in Fresh fruit class to show polymorphic behavior 1.5 marks. Creation of Packaged class with all attributes, constructor and methods 5 marks. Method overriding in Packaged class to show polymorphic behaviour 1.5 marks. Creation of ten different products in driver class 2 marks. Display all created products 2 marks. Program allow user to buy more than one product 2 marks. Display the total amount due and tax component 2 marks. Proper class diagram 2.5 marks.

len2372246

9/18/2019 3:07:47 AM

GENERAL NOTES FOR ASSIGNMENTS - Assignments should usually incorporate a formal introduction, main points and conclusion, and will be fully referenced including a reference list. The work must be fully referenced with in-text citations and a reference list at the end. We strongly recommend you to refer to the Academic Learning Skills materials available in the Moodle. Marks will be deducted for failure to adhere to the word count - as a general rule you may go over or under by 10% than the stated length.

len2372246

9/18/2019 3:07:41 AM

GENERAL NOTES FOR REFERENCING - High quality work must be fully referenced with in-text citations and a reference list at the end. References are assessed for their quality. You should draw on quality academic sources, such as books, chapters from edited books, journals etc. Your textbook can be used as a reference, but not the lecturer notes. We want to see evidence that you are capable of conducting your own research. Also, in order to help markers determine students' understanding of the work they cite, all in-text references (not just direct quotes) must include the specific page number/s if shown in the original.

Write a Review

JAVA Programming Questions & Answers

  Write program to implement autocomplete for given set

CPS 350- Write a program to implement autocomplete for a given set of N terms, where a term is a query string and an associated nonnegative weight. That is, given a prefix, find all queries that start with the given prefix, in descending order of ..

  How are they used in javadoc comments

What is a tag and how are they used in Javadoc comments?

  Explain tostring methods in java

Add an instance variable, named department, of type String. Supply a method toString that prints the manager's name,department, and salary. Make a class Executive inherit from Manager.

  Converts a number entered in roman numerals

Write a program that converts a number entered in Roman numerals to decimal form. Your program should consist of a class, say RomanType. An object of romanType should do the following: a. Store the number as a Roman numeral.b. Convert and store the ..

  Demonstrate the class in a program that contains a car

Demonstrate the class in a program that contains a Car object, and then calls the accelerate method five times. After each call to the accelerate method

  Statements to create a collection of integers

Write Java statements to create a collection of integers, and to initialize each element of the collection to -1. Then, using a for each statement to print the value of each element.

  Define both abstract methods inherited from disease class

Each of these classes extend the Disease class. Each of these class must define (override) both abstract methods inherited from disease

  Design a class which stores demographic information

Design a class which stores demographic information of a person like name, address, phone number, male/female - how will you handle the validations of fields

  1 write an application class that contains several

1 write an application class that contains several methods.nbspthe first method should be named greeting and should

  Program that allows users to enter a dollar amount

Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month. Then ask the user to enter a dollar amount for any number of checks written in a month, up to 50.

  Identifing the appropriate class names, attributes & methods

I am having problems identifing the appropriate class names, attributes and methods for the following objects. I need at least 3 attributes and 3 methods for each class.

  What is the logical expression in your program

Choose two everyday programs you use that utilize different while, do...while, or for loops. Explain which program uses which loop and why that might be. What is the logical expression in your program

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd