Question

Write a program and flowchart. The program should ask the user how many customers they want...

Write a program and flowchart. The program should ask the user how many customers they want to track. Then, it asks for customer numbers, and sales by customer. At the end, it prints out the customer number, the customer sales, and then the total sales and average sales.

  1. You must use two different arrays, one for customer number, and one for sales. These are, in effect, parallel arrays.  
  2. You must use a "while" loop to gather customer number and sales.
  3. You must use a"for" loop to output the customer number and sales by customer.
  4. Program must be in C
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is code:

#include <stdio.h>

int main()

{

int count = 0;

printf("Enter number of customers : ");

scanf("%d", &count);

int number[count];

float sales[count];

float total = 0, average;

int i = 0;

while (i < count)

{

printf("Enter number #%d : ", (i + 1));

scanf("%d", &number[i]);

printf("Enter sales #%d : ", (i + 1));

scanf("%f", &sales[i]);

total += sales[i];

i++;

}

average = total / count;

for (i = 0; i < count; i++)

{

printf("the number is %d\n", number[i]);

printf("the sales is %f\n\n", sales[i]);

}

printf("Total is : %f\n", total);

printf("Average is : %f\n", average);

return 0;

}

Output:

Enter number of customers:3 Enter number #1 : 1 Enter sales #1 : 123 Enter number #2 : 2 Enter sales #2 : 456 Enter number #3

FlowChart:

int count-O read count declare int number[count] float sales[count] float total -0, average int i 0 i < count alse True avera

Add a comment
Know the answer?
Add Answer to:
Write a program and flowchart. The program should ask the user how many customers they want...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program and flowchart. The program should ask the user how many customers they want to track. Then, it asks for customer numbers, and sales by customer. At the end, it prints out the customer...

    Write a program and flowchart. The program should ask the user how many customers they want to track. Then, it asks for customer numbers, and sales by customer. At the end, it prints out the customer number, the customer sales, and then the total sales and average sales. You must use two different arrays, one for customer number, and one for sales. These are, in effect, parallel arrays.   You must use a "while" loop to gather customer number and sales....

  • Write a program that calculates the average of a stream of non-negative numbers. The user can...

    Write a program that calculates the average of a stream of non-negative numbers. The user can enter as many non-negative numbers as they want, and they will indicate that they are finished by entering a negative number. For this program, zero counts as a number that goes into the average. Of course, the negative number should not be part of the average (and, for this program, the average of 0 numbers is 0). You must use a method to read...

  • Ask the user to enter a message Ask the user how many time they want to...

    Ask the user to enter a message Ask the user how many time they want to print the message Then use "while","do-while" and "for" loop to print the message. Show the number at the beginning of the lines when printing. For example: Enter your message: Welcome to Java How many time you want to print this message: 3 Using "while" loop: 1=> Welcome to Java 2=> Welcome to Java 3=> Welcome to Java Using "do-while" loop: 1=> Welcome to Java...

  • write a program code that asks the user how many numbers they wish to find the...

    write a program code that asks the user how many numbers they wish to find the statistics of and then asks the user to enter those numbers. The program must then calculate and display the average variance and standard deviation of the numbers entered by the user. the program code must -ask three user how many numbers they wish to find the statistics of -ask the user to enter those numbers and store them in an array - use a...

  • Write a program that will ask the user for a decimal number such as 18 and...

    Write a program that will ask the user for a decimal number such as 18 and prints the 16 bit binary equivalent of the number: 0000 0000 0001 0010 NOTE: Your output should be a binary string formatted by nibbles (spaces every four bits): 0000 0000 0010 1110 1010 0111 1. Ask the user for a number and store it in an int variable called “number”. 2. Find out how many bits you want to use to represent this number....

  • Ask uFor Ex. "Prompt user to enter a number" = user enters 10, your program should...

    Ask uFor Ex. "Prompt user to enter a number" = user enters 10, your program should output 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.ser to input a number, and then using a loop control statement (While, For, Do-While), output to the console the numbers beginning from 1, up to and including the number input by the user.

  • Write a Program that has a menu with a  layout below, that asks the user if they...

    Write a Program that has a menu with a  layout below, that asks the user if they want to: 1. Converts from feet and inches to meter and centimeters 2. Converts from meter and centimeters to feet and inches 3. Quit the program The program should continue as long as the user asks it to. The program will use a switch statement for the menu option selection. Either a do loo or a do-while loop can be used for the overall...

  • What would the flowchart look like for this? Best Friends Dog Rescue is hosting a Movie...

    What would the flowchart look like for this? Best Friends Dog Rescue is hosting a Movie Charity Event and needs your help capturing what percentage of the night’s sales will be donated to their rescue group. The program should calculate total cost for the number of movie tickets sold for Adults and Children, as well as Snack Sales. The total combined sales for movie ticket sales and snacks should be calculated; and then the percentage of that total calculated. You...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • Write a program using M.I.P.S that asks user “how many positive number that is devisable by...

    Write a program using M.I.P.S that asks user “how many positive number that is devisable by 6 you want to add?” .Then your loopcounter would be the user input. If the user enters a positive number between 1 and 100 that is devisable by 6, you increment your loop counter and add it to the sum.. You need to decide if the positive number entered by the user is divisible by 6 or not. Your program should print an error...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT