Assistance with Question

Home Forums C Programming Assistance with Question

This topic contains 4 replies, has 2 voices, and was last updated by  BeauLGOffsdwntc 8 years, 2 months ago.

  • Author
    Posts
  • #2238

    I would like some assistance please. I need to complete the following question but I can’t get the program running. it is ending after I ask what the input like is.

    The Question:
    The quality control team of a sweets factory wants to check if the packets of lollies contain the amount of lollies
    that they are supposed to contain according to the standards. There are small packets that should contain 50
    lollies and large packets that should contain 100 lollies. Every morning a random number of packets are selected,
    opened and the lollies counted. A file is used to keep record of the number of lollies in each of the randomly
    selected packets together with an indicator to say whether it is a small or large packet. A different number of
    packets is selected every day, so that the total records per file is not known. The letter ‘S’ is used for small
    packets and the letter ‘L’ for large packets. Each line in the file represents the size of one packet and the number
    of lollies inside that packet.
    Use variables of type int to read in the number of lollies, and to calculate all totals, and variables of type
    double to calculate averages. Write a program that will compute and output the following information:
    – Count the number of small packets and the number of large packets
    – Count the number of packets (small and large separately) that contains the required amount of lollies
    according to the standards
    – Compute the average number of lollies per small and per large packet
    It is a requirement that the random selection of packets includes small and large packets. The program should
    assert an error if that is not the case. A value of 0 may also not be captured for the number of lollies – assert an
    error if this is the case. Prompt the user for the name of the file that contains the data to be processed. Write the
    output to a file control.txt.

    My Coding:

  • #3627

    What does your input file look like? What criteria is used to select samples ( randomly ).

  • #3628

    I’m not clear on your question? The input file is an *.dat file.

  • #3629

    Could you perhaps post the input file for your program?

  • #3630

    thanx for the reply, but I sorted this problem

You must be logged in to reply to this topic.

0 Shares
Share
+1
Tweet
Share
Stumble