ITEM A. LEVEL B HOMEWORK ASSIGNMENT You are to read in data for the Great Style Clothing Shop. This data contains how many sales they have for each item of clothing. That data is in the file clothing.in and contains for each item sold by the shop
the catalog number
the color
the total sales
The catalog number and color are to be read in as string variables. Total sales will be a floating point number (as it is a number like 327.42)
Your job is to print out a report indicating how different color items are sold. You are to print out in your report in neat columns and pages using the techniques from Unit 4.12 (which we may or may not cover in class.)
Your report is to list for each color that might have been entered
as the second entry for a particular case, the
number of items in that color, color, total sales
You are to have the data arranged in descending order by total sales and for items with the same dollar volume in ascending order by number of items in that color
The report should be put in the file color.out
ITEM B. LEVEL B ASSIGNMENT
For each of the four problems below,
You are to read in orders from retailers for Jack's Fine Clothing
Wholesalers.
There are three files. For each item ordered, there is the part number, customer number and quanity ordered. These can be found in the file ORDERS.IN
For each part available, there will be a part number, description, color and price. These can be found in PART.DAT
For each customer, there will be a customer number, customer name
two lines of address, city, state, zip code. These can be found in
CUST.DAT
For example if the ORDERS.IN were to have the
following data:
1001
1
10
1002
2
20
1003
1
30
If the PART.DAT file were to contain the following data:
1001
Shirts
White
100
1002
Jeans
White
200
1003
Pants
Black
300
If the CUST.DAT were to have the following data:
1
Walmart Inc.,
Western Illinois University
Apartment #A
Macomb
Illinois
61455
2
Intel Inc.,
Western Illinois University
Apartment #B
Macomb
Illinois
61455
Problem One Counts as 3 B Level Activities
Print out for each customer number, the total number of dollars they owe.
If we were to use the above data files then the program would print out the following :
1
2
10000
4000
Note that customer #1 has two orders. He owes
$1,000 for the first order and
$9,000 for the second order. Hence, the total
would come up to $10,000.
Problem Two A Level ActivityWrite a system to print out invoices for each customer listing the parts they ordered, as well as their address and total owed.
You should Word Perfect or other favorite Word Processor, to take this data from your program and neatly laser print them.
If we were to use the above data files for an example then your output should look like the following :
Name of the company : Walmart
Inc.,
Address: Macomb, Illinois 61455
| Part Number | Parts Ordered | Price per part | Quantity
Ordered | |||||||||||||||||||||||||||||||||||||||||
Name of the company : Intel Inc.,
Address: Macomb, Illinois 61455
| Part Number | Parts Ordered | Price per part | Quantity
Ordered | |||||||||||||||||||||||||||||||||||||||||
Read in a series of colors from the keyboard.
For each color, print out all the customer number and the name who only ordered parts of that color.
For instance, using the above data for an example if we were to
read in White from the key-board then your program
should print out the following:
2
Intel Inc.
Note that although customer #1, i.e Walmart Inc. has ordered some
White shirts, their name is not included in the
above solution. The reason for that is that Walmart Inc., has two
orders of different colors. In other words, they have orders with
mixed colors, i.e an order for black pants and another one for
white shirts. Thus, they are not included.
In another case, if we were to read in Black from
the key-board then your program should print the following:
1
Walmart Inc.
Problem Four
Read in a series of colors from the keyboard.
For each color, print out which customer ordered the most parts of that color.
Again, using the above data, if we were to read in White from the key-board then the program should print out the following output:
Intel Inc.
ITEM C.
LEVEL A HOMEWORK ASSIGNMENT
You are to read in data describing rectangles and points. You are
to print out the rectangle data, sorted in descending order by how
many points are in each rectangle, and then by X and y values.
The data about the rectangles are available in rectangle.in
For each rectangle, you will have the following four floating point numbers.
A. the x-coordinate of the lower left hand corner
B. the y-coordinate of the lower left hand coordinate
C. the width of the rectangle (distance between left and right sides)-- a measurement in the
x direction
D. the height of the rectangle (distance between top and bottom sides) -- a measurement in
the y direction
The data about the points can be found in points.in
For each point, there will be the following two floating point numbers:
A. the x-coordinate of the point B. the y-coordinate of the pointThe output should put in rectangle.out
Each line should contain
A. the x-coordinate of the lower left hand corner
B. the y-coordinate of the lower left hand coordinate
C. the width of the rectangle (distance between left and right sides)-- a measurement in the
x direction
D. the height of the rectangle (distance between top and bottom sides) -- a measurement in
the y direction
E. the number of points that are on the rectangle.
Of course this file should be output so it is sorted by number E
(ascending), and then by number C and then by number D.
A Homework
Remember that there is an A homework assignment in Assignment Set Six that will also count as an assignment at the A level from this assignment set.
ITEM D. COUNTS AS 2 LEVEL A HOMEWORK ASSIGNMENTS This first problem is a modification of Item ? of Assignment Set Five.
In that problem, you developed a utility that would move all the files in a directory onto diskette. It would handle the situation where there were sufficient number of files in the directory that they wouldn't fit on diskette.
You are to modify that program here so it would be somewhat more useful. You are to add the following features:
1. You should provide an option (to be specified on the command line) that will indicate
whether the data is to be moved or copied to diskette.
In the former case, the directory will be emptied out by the time the program is finished.
If copied, then the files will be left in the directory as well as being put on the diskettes.
That means you will need an array to tell you which files have been moved yet.
2. You should prompt the user when a diskette is finished to label the diskette with the
appropriate number (1,2,3, etc.)
3. You should take an option from the command line that will cause the program to print
to "lst" a listing of which files are on which diskette.
The option should indicate whether the data is to be arranged by diskette (giving a
manifest of which files are on each diskette) or by file in which case there will be an
alphabetical list of files, each followed with the number of the diskette. (That's why you
had the user label the diskettes with specified numbers.)
ITEM E.
LEVEL A HOMEWORK ASSIGNMENT
You are to read in data describing rectangles and points. You are
to print out the rectangle data, sorted in ascending order by how
many points are in each rectangle, and then by X and Y values.For each rectangle, you will have the following four floating point numbers.
A. the x-coordinate of the lower left hand corner
B. the y-coordinate of the lower left hand coordinate
C. the width of the rectangle (distance between left and right sides)-- a measurement in the
x direction
D. the height of the rectangle (distance between top and bottom sides) -- a measurement in
the y direction
The rectangle number will be the ordinal position of the rectangle
in this file. That is, the first rectangle would be rectangle
number one, the second one will be rectangle number two, etc.
The data about the points can be found in the file: points.in
For each point, there will be the following two floating point numbers:
A. the x-coordinate of the point B. the y-coordinate of the pointDetermine for each pair of rectangles how many points they have in common. Then generate a sorted file containing for each pair of rectangles, the rectangle number for the first rectangle, the rectangle number for the second rectangle and lastly the number of points they have in common. The data will be sorted by the number of points in common (ascending) and then by the first rectangle number and then by the second rectangle number. Put this sorted file in the file called common.out
ITEM F.
LEVEL A HOMEWORK ASSIGNMENT
This counts as four problems at the A level
You are to read in the following data on the parts and customers sold by the Universal Widget Service.
The data will be as follows:
1. the customer file (CUST.IN)
a. the name of the customer
b. the customer id
c. the name of the city they are in
2. the part file (PART.IN)
a. the part name
b. the part id code
c. a list of cities in which the part is warehoused
d. the number of pounds that the part weights
e. cost of the part
3. the payment record file (PAYREC.IN)
a. the customer id
b. amount of payment
4. Information on how much it costs to ship a pound of product from one city to another
a. the name of the city
b. the name of the second city
c. the cost per pound for shipment between these two cities
5. the order file (ORDERS.IN)
a. the customer id
b. the part id code
c. the amount ordered
You are to figure out for each customer, the total cost for all
their product. This includes shipping it. Note that some items
that the customer bought might be warehoused in more than one city.
In this event, you should assume that the item was shipped from the
warehouse from which it would be cheapest to ship.
Also, assume that to ship a product from a warehouse in a city to a customer also in that city costs $0.25 per pound.
Put in the file (CUSTOUT.OUT) the following data for each customer:
1. the customer id 2. the customer name 3. the total amount purchased 4. the total amount they paid 5. the balance due (amount purchased - amount paid)Sort this data in ascending order of balance due. If two customers have the same balance due, then the customer with the largest customer id should appear first in CUSTOUT.OUT
You are then to sort the lists in lexicographic order. Put the output in LEXICO.OUT LEXICO.OUT should contain the "-1"'s and the "-2" so it can be read in again by the program.
In lexicographic order, one list should be before the other, if the lists are equal up to some point, and then at the point the lists are unequal an element of one list is less than an element of the other list.
For example
2 3 4 5 6 2 5
would be considered less than
2 3 4 5 6 2 4
Likewise,
7 2 3 4 5 8
would be considered greater than
1 9 9 9 9 9 9 9 9 9 9
In the case where there are two lists of different size but where the short list is the same as the first part of the longer list, then the shorter list will be assumed to be less than the longer list.
E. G.,
2 4 5 6 7
would be considered less than
2 4 5 6 7 1 1 1
If LIST.LIS contained
2 7 -1
1 1 1 1 1 1 -1
4 5 6 1 -1
4 5 6 -1
9 -1
-2
LEXICO.OUT would contain
1 1 1 1 1 1 -1
2 7 -1
4 5 6 -1
4 5 6 1 -1
9 -1
-2
ONE LITTLE CAVEAT: You write your program in such manner that the you have no constraints on the maximum size of each list, just the total number of numbers.
That means you have to use two one-dimensional arrays instead of the two-dimensional array that might seem obvious. One will simply contain all the numbers in all the lists. After the read in phase of your program, the first list of numbers will be at the beginning of the array, the second list of numbers will follow immediately.
The second array will simply contain the position of the first number of each of the lists.
Note that when you "sort the lists" all you will be doing is changing elements in the second array.
The first figure below will illustrate the two arrays in memory--prior to sorting. The second figure shows changes after sorting. Note that the array containing the data itself is UNCHANGED. Only the array containing the positions changes.
1: Arrays before sorting
2: What happens after sorting.