Download For this assignment you are to implement 3 classes as described

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Go (programming language) wikipedia , lookup

Structured programming wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Transcript
COP 2250
Pestaina
Assignment 2: Arithmetic & Selection
Due: Sunday, February 02
Spring 2014
Objectives
1. To be able to design implement and test a simple Java program.
2. To be able to implement I/O using JOptionPane methods.
3. To be able to utilize int and double arithmetic.
4. To be able to utilize simple 1-way (if- ) selection,
Overview
Complete Programming Challenge 9, Shipping Charges, from page 176 of the textbook.
Specific Requirements
1. Use the code stub provided to begin coding your solution. Document your program:
a) include your Program Identification Paragraph at the start of your program
b) include helpful comments to document the major steps in your program
2. Define named constants for the pre-determined shipping rates and shipping distance
unit (500 miles).
3. Input the details of a single specific shipment, package weight and shipping distance.
Use JOptionPane.showInputDialog() calls with meaningful prompts. The shipping
distance is a whole number (int). The package weight is a real number (double).
4. To determine the shipping charges, your program must first determine the applicable
shipping rate and the number of distance units to be charged.
a) The number of distance units should be calculated using int arithmetic, / and %,
and a simple if-.
b) The shipping rate should be calculated using a series of simple if- statements.
5. Implement the output using a single JOptionPane.showMessageDialog() method call.
First construct a String message similar to the following
Package Weight: 7.35 Lbs.
Shipping Distance: 876 Miles
2 Distance Units @ $3.70/Unit
Total Shipping Charges: $7.40
Submitting your Assignment
Upload your source (.java) file in SCIS Moodle by the due date. SCIS Moodle will not
allow late submissions.