Metro Coal Sales Report Input/Output Design

Answered using GPT-4o mini by AI Answer Generator

Question:

For the following problem statement, create an input/output design:

The Metropolitan State Coal Co. (Metro) sells coal to electricity producers in Colorado to run their coal-fired power plants. Metro has contracted to deliver a set number of tons and negotiated a separate selling price per-ton with each plant. Sometimes the plant calls with a revised demand which may be more or less than the contracted amount. If the demand is greater than the contracted amount, then the price-per ton on the additional tons is 15% higher than the price-per ton for the contracted tons. For example, if Metro has contracted with a plant to deliver 100 tons at a price of $10/ton, then the sale for the contracted tons will be $10 * 100 tons = $1,000. However, if demand this week is for 120 tons, there is an additional 20 tons required beyond what was contracted. Those additional 20 tons are sold at a 15% mark-up price of $10 * 15% = $11.50 per ton. Therefore, the sales for the 20 additional tons are $11.50 * 20 tons = $230. This means the total sales for the plant are 120 tons at $1,230. When sales occur each week, Metro’s sales manager writes down on a yellow pad of paper 1) the name and abbreviation of the plant which bought coal, 2) the number of contracted tons of that plant, 3) the contracted price per ton and 4) demand for that plant. Metro needs to generate a weekly sales report using a computer program. The report needs to print the sale details for each plant: plant abbreviation, contracted tons, contracted sale amount, additional tons, additional sale amount, and total sales for the plant. Also, the report must include summary statistics for the week to include the 1) number of plants that purchased coal, 2) the total tons and sales for all the plants, 3) the number of plants that required additional coal, 4) the total tons and sales for contracted coal, 5) the total tons and sales for additional coal, 6) and the name of the plant with the highest total sales and that total sales amount​.

Answer:

To design an input/output system for the Metropolitan State Coal Co. (Metro) sales report, we will outline the necessary inputs, outputs, and the structure of the report.

Input Design

The input will consist of the following fields for each plant's transaction:

  1. Plant Name: A string representing the name of the plant.
  2. Plant Abbreviation: A string representing the abbreviation of the plant.
  3. Contracted Tons: An integer representing the number of tons contracted.
  4. Contracted Price per Ton: A float representing the price per ton for the contracted amount.
  5. Demand: An integer representing the current demand for coal from the plant.

Example Input Format

Plant Name: Colorado Power Plant
Plant Abbreviation: CPP
Contracted Tons: 100
Contracted Price per Ton: 10.00
Demand: 120

Output Design

The output will consist of two main sections: detailed sales report for each plant and summary statistics for the week.

Detailed Sales Report for Each Plant

For each plant, the report will include:

  1. Plant Abbreviation
  2. Contracted Tons
  3. Contracted Sale Amount: Calculated as Contracted Tons * Contracted Price per Ton
  4. Additional Tons: Calculated as Demand - Contracted Tons (if Demand > Contracted Tons, otherwise 0)
  5. Additional Sale Amount: Calculated as Additional Tons * (Contracted Price per Ton * 1.15) (if Additional Tons > 0, otherwise 0)
  6. Total Sales for the Plant: Calculated as Contracted Sale Amount + Additional Sale Amount

Example Output Format for Each Plant

Plant Abbreviation: CPP
Contracted Tons: 100
Contracted Sale Amount: $1000.00
Additional Tons: 20
Additional Sale Amount: $230.00
Total Sales for the Plant: $1230.00

Summary Statistics

At the end of the report, the summary statistics will include:

  1. Number of Plants that Purchased Coal: Total count of unique plants.
  2. Total Tons Sold: Sum of all contracted and additional tons sold.
  3. Total Sales Amount: Sum of all contracted and additional sales amounts.
  4. Number of Plants that Required Additional Coal: Count of plants where Demand > Contracted Tons.
  5. Total Tons for Contracted Coal: Sum of all contracted tons.
  6. Total Sales for Contracted Coal: Sum of all contracted sale amounts.
  7. Total Tons for Additional Coal: Sum of all additional tons.
  8. Total Sales for Additional Coal: Sum of all additional sale amounts.
  9. Plant with Highest Total Sales: Name and total sales amount of the plant with the highest total sales.

Example Summary Output

Summary Statistics:
Number of Plants that Purchased Coal: 1
Total Tons Sold: 120
Total Sales Amount: $1230.00
Number of Plants that Required Additional Coal: 1
Total Tons for Contracted Coal: 100
Total Sales for Contracted Coal: $1000.00
Total Tons for Additional Coal: 20
Total Sales for Additional Coal: $230.00
Plant with Highest Total Sales: CPP - $1230.00

Implementation Considerations

  • The program should handle multiple plant entries in a loop until the user indicates they are done entering data.
  • Input validation should be implemented to ensure that the numbers entered are valid (e.g., non-negative integers for tons and valid float for price).
  • The program should be able to store and process the data efficiently, possibly using lists or dictionaries to keep track of each plant's data.
  • The final report should be formatted for readability, possibly using a library for formatted output if