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?
Module main()
Call getDailyProfit()
Call calculateWeeklyProfit()
Call main()
Module getDailyProfit()
// Declare all variables and establish the array
Constant Real SIZE = 7
Declare String days[SIZE] = Sunday, Monday, Tuesday, Thursday. Friday, Saturday
Declare Real days
Declare Real number
Declare Real Index
//Prompt the user for profit information for Sunday
Display “How much did the store profit on Sunday? ”
Input profitSunday
While profitMonday < 0
Display “Your profit cannot be negative. “
Display “Please enter your profit again. “
Input profitSunday
End While
//Call module profitMonday
Call profitMonday()
End Module
Module profitMonday()
//Prompt the user for profit information for Monday
Display “How much did the store profit on Monday”
Input profitMonday
While profitMonday < 0
Display “Your profit cannot be negative. “
Display “Please enter your profit again. “
Input profitMonday
End While
//Call module profitTuesday
Call profitTuesday()
End Module
Module profitTuesday
//Prompt the user for profit information for Tuesday
Display “How much did the store profit on Tuesday”
Input profitTuesday
While profitMonday < 0
Display “Your profit cannot be negative. “
Display “Please enter your profit again. “
Input profitTuesday
End While
//Call module profitWednesday
Call profitWednesday()
End Module
Module profitWednesday()
//Prompt the user for profit information for Wednesday
Display “How much did the store profit on Wednesday”
Input profitWednesday
While profitMonday < 0
Display “Your profit cannot be negative. “
Display “Please enter your profit again. “
Input profitWednesday
End While
//Call module profitThursday
Call profitThursday()
End Module
Module profitThursday()
//Prompt the user for profit information for Thursday
Display “How much did the store profit on Thursday”
Input profitThursday
While profitMonday < 0
Display “Your profit cannot be negative. “
Display “Please enter your profit again. “
Input profitThursday
End While
//Call module profitFriday
Call profitFriday()
End Module
Module profitFriday()
//Prompt the user for profit information for Friday
Display “How much did the store profit on Friday”
Input profitFriday
While profitMonday < 0
Display “Your profit cannot be negative. “
Display “Please enter your profit again. “
Input profitFriday
End While
//Call module profitSaturday
Call profitSaturday()
End Module
Module profitSaturday
//Prompt the user for profit information for Saturday
Display “How much did the store profit on Saturday”
Input profitSaturday
While profitMonday < 0
Display “Your profit cannot be negative. “
Display “Please enter your profit again. “
Input profitSaturday
End While
End Module
Module calculateWeeklyProfit
//Process all input to provide a weekly profit
Set weeklyProfit = profitSunday + profitMonday + profitTuesday + profitWednesday + profitThursday + profitFriday + profitSaturday
//Display the weeks profit after processing
Display “This week's current profit is $“, weeklyProfit
//If weekly profit exceeds $3500 then display that they have met their goal for the week
If weeklyProfit > 3500 then
Display “You have met your weekly goal! “
Else
Display “You have not met your weekly goal. “
End Module
//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();
}
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...
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("======================================================================") 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 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 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 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 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 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 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 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 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...