Docsity

Assignment 3 - Structured Problem Solving Using the Computer | ITK 168.00, Assignments of Information Technology

Toggle sidebar
bg1
ITK 168, Califf Fall 2004
ITK 168 Program 3
Due Date: Friday, October 8 at start of class.
Objective: Practice writing and testing a class
The Problem:
You will create a Pizza class to store sales information for a pizza parlor. Each Pizza
object will maintain information about a particular kind of pizza sold by the pizza parlor.
You will then write a driver program that thoroughly tests your class.
The Class:
Your Pizza class should have the following attributes:
The type of pizza
The cost of that type (the parlor only sells one size)
The number of pizzas of that type sold
Use appropriate types for each attribute, and make sure that all attributes are private.
Your pizza class should have the following methods:
A default constructor (one that takes no arguments)
A constructor that accepts the type of pizza and the cost.
Accessors (getters) for the pizza type and cost.
Mutators (setters) for the pizza type and cost.
A sellPizza method that updates the number of pizzas sold. It should have one
argument that specifies the number of pizzas sold in a particular sale.
A printReport method that prints out the type of pizza, the cost, the number of
pizzas sold, and the total amount received for pizzas of that type. This
information should be neatly formatted in a columnar style.
The driver:
Assume that the pizza parlor sells two kinds of pizza: cheese and pepperoni. Cheese
pizzas cost $9.00 and pepperoni pizzas cost $10.50. Write a driver program, TestPizza,
that lets two customers purchase pizzas, asking how many of each kind of pizza the
customer wants, and then reporting the total cost of the pizzas. The program should also
print a report of the sales for the current run of the program. Make certain that your
driver program tests EVERY method in your Pizza class.
Requirements:
Turn in a class diagram for the Pizza class.
Your program should consist of two files: Pizza.java and TestPizza.java.
Zip the files and name the resulting file Prog3.zip.
Electronically submit the file Prog3.zip using Web Submit under project 3. Be
sure that you submit your program to section 7.
1
pf3
pf4

Partial preview of the text

Download Assignment 3 - Structured Problem Solving Using the Computer | ITK 168.00 and more Assignments Information Technology in PDF only on Docsity!

ITK 168 Program 3

Due Date: Friday, October 8 at start of class. Objective : Practice writing and testing a class The Problem: You will create a Pizza class to store sales information for a pizza parlor. Each Pizza object will maintain information about a particular kind of pizza sold by the pizza parlor. You will then write a driver program that thoroughly tests your class. The Class: Your Pizza class should have the following attributes:  The type of pizza  The cost of that type (the parlor only sells one size)  The number of pizzas of that type sold Use appropriate types for each attribute, and make sure that all attributes are private. Your pizza class should have the following methods:  A default constructor (one that takes no arguments)  A constructor that accepts the type of pizza and the cost.  Accessors (getters) for the pizza type and cost.  Mutators (setters) for the pizza type and cost.  A sellPizza method that updates the number of pizzas sold. It should have one argument that specifies the number of pizzas sold in a particular sale.  A printReport method that prints out the type of pizza, the cost, the number of pizzas sold, and the total amount received for pizzas of that type. This information should be neatly formatted in a columnar style. The driver: Assume that the pizza parlor sells two kinds of pizza: cheese and pepperoni. Cheese pizzas cost $9.00 and pepperoni pizzas cost $10.50. Write a driver program, TestPizza , that lets two customers purchase pizzas, asking how many of each kind of pizza the customer wants, and then reporting the total cost of the pizzas. The program should also print a report of the sales for the current run of the program. Make certain that your driver program tests EVERY method in your Pizza class. Requirements:  Turn in a class diagram for the Pizza class.  Your program should consist of two files: Pizza.java and TestPizza.java.  Zip the files and name the resulting file Prog3.zip.  Electronically submit the file Prog3.zip using Web Submit under project 3. Be sure that you submit your program to section 7.

 Turn in a printout of the final version of your source code that exactly matches file you submitted.  The program must follow the coding guidelines handed out in class including the guidelines for commenting methods.  The program should be well commented Planning On Friday, October 1, you must turn in your class diagram for the pizza class and a plan for your driver program. Remember that your plan for the driver program should be a lists of tasks that the program must complete, not a list of tasks that you must complete.

Grading Standards

A perfect program will: Run correctly, meeting all specifications from the assignment Have a well designed class with proper encapsulation Be correctly formatted with clear indentation Will follow good programming practices Be well commented, following the coding guidelines for this class Be submitted correctly, both electronically and on paper (in a pocket folder, with grade sheet and all required materials, etc.) An ‘A’ program: Will run correctly, meeting all specifications from the assignment Have a well designed class with proper encapsulation Will follow good programming practices May have no more than two minor errors in commenting, format, and/or submission A ‘B’ program: Have a well designed class with proper encapsulation Will follow good programming practices May have minor errors in execution or more than 2 minor errors in commenting, format, and/or submission or a single major error A ‘C’ program: Will compile and run May have multiple minor errors or errors in multiple areas or up to 2 major errors A ‘D’ program Will compile and run Has serious errors in execution An ‘F’ program Does not compile or does not run or substantially fails to follow the assignment guidelines or has a number of errors of different kinds