Question

I have this code and need this to be written and applied with an array? How do I process this? Also What would I apply t...

I have this code and need this to be written and applied with an array? How do I process this? Also What would I apply this with flowchart?

  1. Module main()

  2.   Call getDailyProfit()

  3.   Call calculateWeeklyProfit()

  4. Call main()

  5. Module getDailyProfit()

  6.   // Declare all variables and establish the array

  7.          Constant Real SIZE = 7

  8.          Declare String days[SIZE] = Sunday, Monday, Tuesday, Thursday. Friday, Saturday

  9.          Declare Real days

  10.          Declare Real number

  11.          Declare Real Index

  12.          

  13.   //Prompt the user for profit information for Sunday

  14.          Display “How much did the store profit on Sunday? ”

  15.          Input profitSunday

  16.     While profitMonday < 0

  17.          Display “Your profit cannot be negative. “

  18.          Display “Please enter your profit again. “

  19.          Input profitSunday

  20.     End While

  21.   //Call module profitMonday

  22.   Call profitMonday()

  23. End Module

  24. Module profitMonday()    

  25.   //Prompt the user for profit information for Monday

  26.          Display “How much did the store profit on Monday”

  27.          Input profitMonday

  28.     While profitMonday < 0

  29.          Display “Your profit cannot be negative. “

  30.          Display “Please enter your profit again. “

  31.          Input profitMonday

  32.     End While

  33.   //Call module profitTuesday

  34.   Call profitTuesday()

  35. End Module

  36.     

  37. Module profitTuesday

  38.   //Prompt the user for profit information for Tuesday

  39.          Display “How much did the store profit on Tuesday”

  40.          Input profitTuesday

  41.      While profitMonday < 0

  42.          Display “Your profit cannot be negative. “

  43.          Display “Please enter your profit again. “

  44.          Input profitTuesday

  45.     End While

  46.   //Call module profitWednesday

  47.   Call profitWednesday()

  48. End Module

  49. Module profitWednesday()    

  50.   //Prompt the user for profit information for Wednesday

  51.          Display “How much did the store profit on Wednesday”

  52.          Input profitWednesday

  53.     While profitMonday < 0

  54.          Display “Your profit cannot be negative. “

  55.          Display “Please enter your profit again. “

  56.          Input profitWednesday

  57.     End While

  58.   //Call module profitThursday

  59.   Call profitThursday()

  60. End Module

  61. Module profitThursday()     

  62.   //Prompt the user for profit information for Thursday

  63.          Display “How much did the store profit on Thursday”

  64.          Input profitThursday

  65.     While profitMonday < 0

  66.          Display “Your profit cannot be negative. “

  67.          Display “Please enter your profit again. “

  68.          Input profitThursday

  69.     End While

  70.   //Call module profitFriday

  71.   Call profitFriday()

  72. End Module

  73. Module profitFriday()

  74.   //Prompt the user for profit information for Friday

  75.          Display “How much did the store profit on Friday”

  76.          Input profitFriday     

  77.     While profitMonday < 0

  78.          Display “Your profit cannot be negative. “

  79.          Display “Please enter your profit again. “

  80.          Input profitFriday

  81.     End While

  82.   //Call module profitSaturday

  83.   Call profitSaturday()

  84. End Module

  85.     

  86. Module profitSaturday

  87.   //Prompt the user for profit information for Saturday

  88.          Display “How much did the store profit on Saturday”

  89.          Input profitSaturday

  90.     While profitMonday < 0

  91.          Display “Your profit cannot be negative. “

  92.          Display “Please enter your profit again. “

  93.          Input profitSaturday

  94.     End While

  95. End Module

  96. Module calculateWeeklyProfit

  97.   //Process all input to provide a weekly profit

  98.     Set weeklyProfit = profitSunday + profitMonday + profitTuesday + profitWednesday + profitThursday + profitFriday + profitSaturday

  99.   //Display the weeks profit after processing

  100.          Display “This week's current profit is $“, weeklyProfit

  101.   //If weekly profit exceeds $3500 then display that they have met their goal for the week

  102.   If weeklyProfit > 3500 then

  103.               Display “You have met your weekly goal! “

  104.   Else

  105.          Display “You have not met your weekly goal. “

  106. End Module

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//above code with array implementation in C programming

#include<stdio.h>
#include<conio.h>
#define size 7
void getprofit()
{
   int days[size];
   int i=0,sum=0;
   for(i=0;i<7;i++)
   {
       if(i==0)
       {
           printf("Enter monday profit");
           scanf("%d",&days[i]);
           if(days[i]<0)
           {
               printf("profit can't be negative");
               printf("\nEnter monday profit");
               scanf("%d",&days[i]);
           }

       }
       if(i==1)
       {
           printf("Enter tuesday profit");
           scanf("%d",&days[i]);
           if(days[i]<0)
           {
               printf("profit can't be negative");
               printf("\nEnter tuesday profit");
               scanf("%d",&days[i]);
           }

       }
       if(i==2)
       {
           printf("Enter wednesday profit");
           scanf("%d",&days[i]);
           if(days[i]<0)
           {
               printf("profit can't be negative");
               printf("\nEnter wednesday profit");
               scanf("%d",&days[i]);
           }

       }
       if(i==3)
       {
           printf("Enter thursday profit");
           scanf("%d",&days[i]);
           if(days[i]<0)
           {
               printf("profit can't be negative");
               printf("\nEnter thursday profit");
               scanf("%d",&days[i]);
           }

       }
       if(i==4)
       {
           printf("Enter friday profit");
           scanf("%d",&days[i]);
           if(days[i]<0)
           {
               printf("profit can't be negative");
               printf("\nEnter friday profit");
               scanf("%d",&days[i]);
           }

       }
       if(i==5)
       {
           printf("Enter saturday profit");
           scanf("%d",&days[i]);
           if(days[i]<0)
           {
               printf("profit can't be negative");
               printf("\nEnter saturday profit");
               scanf("%d",&days[i]);
           }

       }
       if(i==6)
       {
           printf("Enter sunday profit");
           scanf("%d",&days[i]);
           if(days[i]<0)
           {
               printf("profit can't be negative");
               printf("\nEnter sunday profit");
               scanf("%d",&days[i]);
           }

       }
   }
   for(i=0;i<7;i++)
   {
       sum=sum+days[i];
   }
   printf("this week's current profit is %d",sum);
   if(sum>3500)
       printf("\nYou have met your weekly goal...!");
   else
       printf("\nYou have not met your weekly goal");
}
void main()
{
   clrscr();
   getprofit();
   getch();
}

Add a comment
Know the answer?
Add Answer to:
I have this code and need this to be written and applied with an array? How do I process this? Also What would I apply t...
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
  • Pseudocode please Special Problem for Swap A local zoo wants to keep track of how many...

    Pseudocode please Special Problem for Swap A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 x 7 array, where each row represents a different monkey and each column represents a different day of the week. The monkeys are represented by integers 1, 2, and 3; the weekdays are "Sunday" "Monday" "Tuesday". "Wednesday. Thursday"....

  • Need help writing this code in python. This what I have so far. def display_menu(): print("======================================================================")...

    Need help writing this code in python. This what I have so far. def display_menu(): print("======================================================================") print(" Baseball Team Manager") print("MENU OPTIONS") print("1 - Calculate batting average") print("2 - Exit program") print("=====================================================================")    def convert_bat(): option = int(input("Menu option: ")) while option!=2: if option ==1: print("Calculate batting average...") num_at_bats = int(input("Enter official number of at bats: ")) num_hits = int(input("Enter number of hits: ")) average = num_hits/num_at_bats print("batting average: ", average) elif option !=1 and option !=2: print("Not a valid...

  • IP requirements: Load an exam Take an exam Show exam results Quit Choice 1: No functionality...

    IP requirements: Load an exam Take an exam Show exam results Quit Choice 1: No functionality change. Load the exam based upon the user's prompt for an exam file. Choice 2: The program should display a single question at a time and prompt the user for an answer. Based upon the answer, it should track the score based upon a successful answer. Once a user answers the question, it should also display the correct answer with an appropriate message (e.g.,...

  • Please help me write a program flowchart! I have been struggling for quite some time, and...

    Please help me write a program flowchart! I have been struggling for quite some time, and mainly I need the answer. Thank you ! room Hef main(); #run order: date waitlist budget result numGuests = guests() weekDay = date() waitList = waitlist(weekDay) hotelBudget - budget() print("Day:, displayWeek (weekDay)) print("Budget: ", hotel Budget) result(waitList, numGuests, room(numGuests, hotelBudget)) def guests(): numGuests - while numGuests <=@ or numGuests > 8: try: numGuests = (int(input("Please enter number of guests:"))) if numGuests > 8: print("Maximum...

  • Lab Topics • The basics of Array object Use the following Coding Guidelines • When declaring...

    Lab Topics • The basics of Array object Use the following Coding Guidelines • When declaring a variable, you usually want to initialize it. Remember you cannot initialize a number with a string. Remember variable names are case sensitive. Use tabs or spaces to indent code within blocks (code surrounded by braces). Use white space to make your program more readable. Use comments after the ending brace of classes, methods, and blocks to identify to which block it belongs. Problem...

  • PLEASE READ AND CODE IN BASIC C++ CODE. ALSO, PLEASE CODE USING THIS DO WHILE LOOP...

    PLEASE READ AND CODE IN BASIC C++ CODE. ALSO, PLEASE CODE USING THIS DO WHILE LOOP AND FORMAT: #include <iostream> using namespace std; int main() { //variables here    do { // program here             }while (true);    } Objectives To learn to code, compile and run a program containing SELECTION structures Assignment Write an interactive C++.program to have a user input the length of three sides of a triangle. Allow the user to enter the sides...

  • Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a...

    Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the...

  • I am writing a Python program to serve as a fitness tracker. I would love some...

    I am writing a Python program to serve as a fitness tracker. I would love some input as to how you would code this. I've included what I want this program to accomplish, what I will keep track of, and below all of that I have posted the assignment guidelines. Any suggestions on how to make this better/ more efficient would be welcome! I'm thinking of making a weekly tracker that takes input per day, and outputs at the end...

  • Need code written for a java eclipse program that will follow the skeleton code. Exams and...

    Need code written for a java eclipse program that will follow the skeleton code. Exams and assignments are weighted You will design a Java grade calculator for this assignment. A user should be able to calculate her/his letter grade in COMS/MIS 207 by inputting their scores obtained on worksheets, assignments and exams into the program. A skeleton code named GradeCompute.java containing the main method and stubs for a few other methods, is provided to you. You must not modify/make changes...

  • Please, I need help, I cannot figure out how to scan variables in to the function...

    Please, I need help, I cannot figure out how to scan variables in to the function prototypes! ******This is what the program should look like as it runs but I cannot figure out how to successfully build the code to do such.****** My code: #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> #include <conio.h> float computeSeriesResistance(float R1, float R2, float R3); float computeParallelResistance(float R1, float R2, float R3); float computeVoltage(int current, float resistance); void getInputR(float R1, float R2, float R3); void getInputCandR(int...

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