联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2018-05-01 07:21

ACME Anvils Order Taking version 3.0

This assignment is a follow-on to Programming Assignments 1 and 2: Data and Decisions. In this

assignment, you can imagine that once again, users are demanding more features and better

experiences. In this assignment, you’ll modify your OrderAnvils2 solution to create its successor:

OrderAnvils3.

This spec is presented as an amendment to the Programming Assignment 2.0 spec. Unlike Programming

Assignment 2.0, you will not receive an updated full spec for this assignment.

Some important notes

• Good coding practice, including adherence to standards, is important. Penalties for ignoring

standards and for ignoring coding practices we’ve reviewed in class are higher for this assignment.

• Starting with this assignment, penalties will be assessed for grossly inefficient code.

• If you use a feature we haven’t covered in class:

o Make sure your code conforms to the SDS or you may lose points.

o Make sure you’re using the feature properly and that it adds value to your solution. If it does

not, you may lose points.

2 of 13

How to get started

You can either start this assignment from scratch or use your source code from Programming

Assignment 1 as a starting point. If you choose to do the latter, here’s a simple way to do it:

1. Create a new solution for Programming Assignment 3. You can name it whatever you want.

Leave Visual Studio open.

2. In the File Explorer, find your Programming Assignment 2 solution folder and open the .cs file

that holds your program.

3. Select all lines in the program (Ctrl+A) and copy them to the clipboard (Ctrl+C).

4. Return to the solution you created in step 1. From the Solution Explorer, open Program.cs.

5. Select all lines in that .cs file (Ctrl+A) and replace them by pasting the code you put on the

clipboard (Ctrl+V).

Plan of Attack

1. Start by copying your solution for Programming Assignment 2 or 2.5 into a new Visual Studio

solution named OrderAnvils3. Here’s a video to help you get started. You should preserve your

work from the preceding assignment for your records. If you’re concerned that your solution to HW

2.5 is not a good foundation for HW 3, please talk to me about it.

2. Make sure you understand what is required for this assignment! This is just like the real world: if

there is ambiguity, it’s up to you to resolve it. Review the materials carefully and ask clarifying

questions when needed.

3. Plan and estimate your work. Note that this assignment requires that you submit a time sheet with

your solution.

4. Build pseudocode or a flowchart to help you work out the logic.

5. Write down a set of test cases that will help you to ferret out logic problems and ensure that your

code is working.

6. Code, test and debug using your test cases.

7. Keep track of the actual time you spend on each step and report it on your time sheet.

3 of 13

Specification

The basic of shape of the OrderAnvils application remains the same in this new version, but there are a

few changes and upgrades that have been requested by its users. If a particular feature is not

mentioned here, it is to behave just as it did in the previous version.

Countdown to Taking an Order

In the latest contract between ACME and the Animation Industry Order Takers Union, there is a new

provision that Order Takers be given 3-seconds of down time before taking each order. Prior to

answering the phone for the first and all subsequent orders, they will see the union-mandated 3-second

countdown timer, during which they are expected to emotionally prepare for their next customer

encounter. Only after the timer expires will they be allowed to take the next order.

When the timer expires, sound an audible alarm and display a NEW ORDER banner to rouse the order

taker.

Repeated Order Taking

Currently, after the order taker takes an order, they must restart the application to take another. They

would like that behavior improved so that after they have finished one order, they are asked whether

they are ready to take another order. If the user responds “no”, the program exits gracefully. But if

they say “yes”, the program goes back into countdown mode.

A new promotion!

Our current promotion offers each and every customer the choice of a free bat suit or a free dehydrated

boulder. This promotion was a great success, but has proven costlier than the marketing team

anticipated. This promotion is being scrapped in favor of an exciting, new program!

In this promotion, ACME will offer Futility Club Members – ONLY Futility Club members - the opportunity

to play for the chance to win a jet-propelled unicycle. All they must do is to guess the secret number!

We will also make sure that non-Futility Club members are fully aware that they are missing out on the

chance of a lifetime simply because they are not ACME loyalists.

Members-Only “Jet-Propelled Unicycle Extravaganza” User Experience

After running numerous focus groups and usability studies, the marketing department has settled on the

following behavior. Make sure to use the wording below precisely, because this is the EXACT PHRASING

the marketing folks believe will best engender customer loyalty and increased engagement.

The script starts at the point that the customer is asked whether they belong to the Futility Club. “OT”

stands for order taker.

4 of 13

OT: Are you a member of our Futility Club, the frequent shopper program that

rewards persistence over results? (“Y” if yes):

If the customer replies that they are:

OT: Excellent! You’ll receive an AMAZING 15% discount on today’s purchase!

What’s more, as a valued member of our loyalty program, you’ll have a chance

to win a bonus gift in our exciting Members-Only Jet-Propelled Unicycle

contest! Pick a number between 1 and 10!

If the customer refuses to play, suggests a non-numeric value or suggests a number that is out of bounds,

the order taker delivers this mild taunt and bypasses.

OT: That’s not a number between 1 and 10. What an ultra-maroon! Still, we

value your loyalty.


If the user chooses to play, the order taker accepts their input and types it in. Of course, the system must

ensure that the incoming value is an integer between 1 and 10.

If the user wins the game:

OT: Woo hoo! You guessed the secret number: (their guess). An ACME JetPropelled

Unicycle is headed your way!

5 of 13

If the user loses the game:

OT: Aww, too bad. You guessed (their guess), but the secret number was

(computer-generated secret number). No unicycle. What a loser. Very sad.

If the user is NOT a member of the Futility Club:

OT: What’s wrong with you? That just cost you a 15% discount and an

opportunity to win a unicycle. Sad.

Validation

We need to add validation to more fields to help our order takers to be the best order takers in the

business. Here are the specifics per field:

• Number of anvils must be a positive, whole number. Error message: Number of anvils must

be a positive, whole number.

• Name is a required field, so it must have some value. Error message: Customer name is

required.

• State can only have the abbreviation of one the selected states we serve: AK, WA, OR, CA, AZ, NM,

CO, and UT. Error message: We do not ship to the string the user entered.

This is NOT a requirement for full credit. If you implement it properly, though, you’ll earn bonus

points.

• Zip must exactly 5 characters long. Error message: Zip code must be 5 characters

long.

For each of these fields, use a validation loop to ensure that the user provides a valid value for

continuing processing.

Other changes

• It’s election year, so the sales tax rate has dropped from 10% to 9.95%.

• The free shipping program for OR and WA customers is being discontinued.

• The Futility Club discount percentage has dropped from 20% to 15%.

• The volume discount ranges have been fine-tuned as follows:

o 1 – 9 anvils: $80 per anvil.

o 10 - 19 anvils: $72.35 per anvil

o 20 or more anvils: $67.99 per anvil.

6 of 13

For full credit…

Naming

Submit two files for this assignment. The names do not matter.

• The .cs file for your project.

• A Word file with test plan and time sheet.

General requirements

• The program must behave as described above.

• The program must execute without any exceptions (i.e., run-time errors).

• There must be no warnings.

• The code must conform to the course Software Development Standards in all other respects,

including comments.

• Show a three-second countdown timer prior to the taking of each order. When time expires, sound

an audible alarm.

• For each field that requires validation, ensure that the user provides a valid value before continuing

by using a validation loop.

• For the Members-Only Jet-Propelled Unicycle Extravaganza dialog, use the exact wording from the

specification.

• Make sure the invoice output is complete. It must display:

o A Welcome message with a slogan.

o Customer name and address.

o Number of anvils ordered.

o Subtotal (number of anvils ordered multiplied by price per anvil).

o Discount amount, if the customer is entitled to a frequent shopper (Futility Club) discount.

o Taxable amount (Extension minus discount)

o Tax

o Total due (Taxable amount plus tax)

o If the customer has won a unicycle, a congratulatory message.

o A closing (“goodbye”) message.

• After an order is successfully taken, offer the order taker the opportunity to take another order.

7 of 13

Usability

• Input prompts must appear on the same line on which the data is entered.

• Input should be case insensitive if possible. E.g., if you need a yes or no value, accept “Y” or “y”.

• Output should be readable. Use spaces, tabs, and formatting to spruce up the console output.

• All output must be spelled correctly.

• Dollar amounts must appear in currency format.

• Dollar amounts in the invoice must be aligned and right-justified.

• The user experience need not be the same as the example at the end of this document, but should

be similar.

Required coding features and hints

• Use at least one of each of the three loop statements: while, for and do-while.

• For the Members-Only Jet-Propelled Unicycle Extravaganza, use the Random.Next method you used

in the GuessingGame assignment to generate a random number that is greater than zero and less

than or equal to 10.

• Make sure to use efficient and accurate range checks per pages 171-172 of the text.

• For the countdown timer, use the following call to pause for one second. It puts the executing

thread to sleep for 1 second (1000 milliseconds):

System.Threading.Thread.Sleep(1000);

• Do not use break (except in a switch statement) or continue.

• Do not use return or Environment.Exit()

• Do not use goto.

• Do not use variables of type var.

• Do not include any commented-out code in your submission.

8 of 13

Documentation

For this assignment, you’ll need to prepare two items of documentation: a set of test cases and a time

sheet. You can put them into a single file or submit them separately.

Test cases

For this assignment, you must prepare a list of 10 or more test cases against which you have validated

your code.

As a reminder, here’s an example section of a test plan for OrderAnvils3.

ID Case Expected Result

1 Num anvils 1

State WA

Zip x

Zip 99999

Futility Club = n

Countdown

Loop on Zip == x

No game

Subtotal: 80

Tax: 7.96

Total: 87.96

Y for next order

2 Num anvils 10

State xx

State AZ

Futility Club = y

Play game (and win)

How to make sure to win the game?

Loop on bad state

Game, win game, see immediate congrats

Sub: 723.50

Disc: 108.53

Taxable: 614.98

Tax: 61.19

Total: 676.17y

Look for second congrats on invoice

Y for next order

3 … …

9 of 13

Time sheet

Please prepare a time sheet to be submitted with this exercise. When you’re done, it should look

something like this:

Date Task Estimated Hours Actual Hours

4/11/2017 Define the problem .5 1

4/12/2017 Design user interaction 1 1

4/12/2017 Design logic 2 2

4/13/2017 Build test cases 1 2

4/14/2017 Code, test, debug 3 4

4/14/2017 Assemble documentation .5 1

Total 8.0 11.0

Start by listing the tasks you need to accomplish and try to predict how long each task will take. Then,

as you build your solution, track how much time you spend on each task. You’ll find it illuminating.

If you use the time sheet as intended, it will serve two purposes:

1. By breaking your work into bite-sized chunks, you’ll have a better handle on the task ahead.

2. Predicting how long it will take you to accomplish each step and comparing it to the actual time you

used will help you to:

a. Identify places where you may be able to improve efficiency. For instance, if the “code, test and

debug” step takes too long, it may be the result of having skimped on designing the logic

beforehand.

b. Develop estimating skills. If you pursue coding as a living, you’ll need to be able to tell the

people with and for whom you’re working how long it’s going to take to complete a task.

You need not follow these precise steps, but use the SDLC document in the Useful Info module to guide

you.

You must include the Total row to receive credit.

10 of 13

Sample output 1 – Errors, eventual success, no loyalty discount

In the example interaction below, data typed by the user appears highlighted and in boldface.

************************ ACME Anvils Corporation *******************************

Supporting the animation industry for 70 years and counting!

Countdown to Order

3

2

1

******************************* NEW ORDER **********************************

SCRIPT: Hi, I'm <your name here>. How many anvils would you like to order today?

Number of anvils: 1

SCRIPT: I can certainly help you with that. Could you please give me your

name and address?

First and last name: Yosemite Sam

Street address: 15 Main St

City: Rising Gorge

State (2 letters): NM

Zip code: 805269

***ERROR. Zip code must be 5 characters long.

Zip code: 80526

SCRIPT: Are you a member of our Futility Club, the frequent shopper program

that rewards persistence over results? ("Y" if yes): n

SCRIPT: What's wrong with you? That just cost you a 15% discount and

an opportunity to win a unicycle. Sad.

Press any key to display invoice. . .

Continued on next page…

11 of 13

****************************************************************************

************************ ACME Anvils Corporation ***************************

CUSTOMER INVOICE

SHIP TO:

Yosemite Sam

15 Main St

Rising Gorge

NM

80526

Quantity: 1

Cost per anvil: $80.00

Subtotal: $80.00

No discount for you! $0.00

Taxable amount: $80.00

Sales Tax: $7.96

__________

TOTAL: $87.96

****************************************************************************

SCRIPT: Your total today is $87.96. Thanks for shopping with Acme!

SCRIPT: And don't forget: Acme anvils fly farther, drop faster, and land harder than

any other anvil on the market!

Ready to take another order? y

12 of 13

Sample output 2 – Errors, loyalty discount, win the game

In the example interaction below, data typed by the user appears highlighted and in boldface. Note

that this is a continuation of the session begun in sample 1.

Countdown to Order

3

2

1

******************************* NEW ORDER **********************************

SCRIPT: Hi, I'm <your name here>. How many anvils would you like to order today?

Number of anvils: 10

SCRIPT: I can certainly help you with that. Could you please give me your

name and address?

First and last name: Elmer J. Fudd

Street address: 3215 La Cienega Blvd.

City: Studio City

State (2 letters): xx

***ERROR. We do not ship to xx.

State (2 letters): CA

Zip code: 90653

SCRIPT: Are you a member of our Futility Club, the frequent shopper program

that rewards persistence over results? ("Y" if yes): y

SCRIPT: Excellent! You'll receive an AMAZING 15% discount on today's purchase!

What's more, as a valued member of our loyalty program, you'll have a chance

to win a bonus gift in our exciting Members-Only Jet-Propelled Unicycle

Extravaganza contest!

Pick a number between 1 and 10: 5

SCRIPT: Woo hoo! You guessed the secret number: 5!

An ACME Jet-Propelled Unicycle is headed your way!

Press any key to display invoice. . .

Continued on next page…

13 of 13

****************************************************************************

************************ ACME Anvils Corporation ***************************

CUSTOMER INVOICE

SHIP TO:

Elmer J. Fudd

3215 La Cienega Blvd.

Studio City

CA

90653

Quantity: 10

Cost per anvil: $72.35

Subtotal: $723.50

Less 15 % Futility Club: ($108.53)

Taxable amount: $614.98

Sales Tax: $61.19

__________

TOTAL: $676.17

And congratulations on winning a FREE JET-PROPELLED UNICYCLE!!!

****************************************************************************

SCRIPT: Your total today is $676.17. Thanks for shopping with Acme!

SCRIPT: And don't forget: Acme anvils fly farther, drop faster, and land harder than

any other anvil on the market!

Ready to take another order? n

Press any key to end program...


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp