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...
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...
Write the pseudocode below as a working Python program. Take a screenshot of your code and output and paste into your answer document. User input of ‘y’ or ‘Y’ should cause the loop to continue. // Constant for the commission rate // Declare as a global variable Constant Real COMMISSION_RATE = 0.10 Module main() // Local variable Declare String keepGoing = "y" // Calculate as many commissions // as needed. While...
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...
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...
The Requirement (What you need to do) You are asked to write a program that takes as input a dollar amount, and then displays the dollar amount in English (similar to how you would write the amount in a check). Use case (Scenario) $PrintDollar Enter the dollar amount:$23.45 It's twenty three and 45/100 Try again(y/n):n Bye! Error handling: You are required to handle the following error inputs. If the input is any of the following case, your program should display...
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...
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...