CS 405 Assignment 3

Toy Box Price Calculator - Due February 11

The purpose of this assignment is to give you experience with control flow.

Program Requirements

When run, your program should open a window that looks like the following window:

This is the same toybox calculator that we did in class. For students who are interested, I am providing some starter code that contains a slightly modified version of the toybox program I made in class, and it can be downloaded here. Details about the specifications for the toyboxes can be found in the following PDF.a

As we discussed in class on February 4, the price of wood is such that it is not linear with the size of the board, but rather the price increases superlinearly. Your assignment is to make it so the provided toybox application is able to calculate the price of the toybox using the alternative pricing, specified below.

Less than or equal to 3 inches$0.11 per square inch
Less than or equal to 5 inches$0.12 per square inch
Less than or equal to 7 inches$0.14 per square inch
Less than or equal to 9 inches$0.16 per square inch
Less than or equal to 11 inches$0.20 per square inch
More than 11 inches$0.21 per square inch

When the user enters data into the text boxes, the price of the toybox should be displayed as follows.

Each piece of wood is priced such that the smaller of the two dimensions is the width, and the longer of the two dimensions is the length.

Input Validation

The first type of input validation I expect you to do is to make sure that the input consists only of valid numbers. If the user enters something that is not a number, you should have an error message like follows.

There are additional restrictions on the dimensions. The first restriction is that the toyboxes cannot be made too small. All pieces of wood must have their smaller dimension, the width, greater than or equal to 3 inches. If a user enters a number that is too small, they should get an error message as follows:

The second restriction is that the toyboxes cannot be made too large. All pieces of wood must have their smaller dimension, the width, less than or equal to 12 inches. If a user enters a number that is too small, they should get an error message as follows:

This toybox requires creating a front which is 14 * (16-1) = 14 x 15, which is too big, hence the error message appearing.

Evaluation

Submission Instructions

To submit this program, I would like all students to zip their project, and send it to me. I would like you to submit the entire project, which should be named Prog_3_lastname, where lastname is your last name. For me, this is Prog_3_Wilt. Students should email their completed projects to cs405@cs.unh.edu.

Late Policy

The assignment is due prior to midnight on the listed due date. For this assignment, that means you must turn in your solution before to February 12.

Unlike other classes you may have taken in the past, no late work is allowed for this class. This is worth repeating, because it is extremely important: no late work is allowed for this class. We will move quickly, and I do not want students straggling behind trying to catch up on work from previous weeks, which is what generally happens when late work is accepted.