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...
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...
I need to write a program in java using two array lists. I need to program to prompt the user to enter a day of the week and return an output of a predetermined temperature for the day they selected. I also need the program the output the average of daily temperatures across the week if the user inputs "week". So basically if i set the temperatures to something arbitrary i.e.: Monday = 50 Tuesday = 55 Wednesday = 52...
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...
Need this program ASAP
C++ language
1b. Write the implementation file timeClock.cpp for the class TimeClock. Com pile the file, and save it in the Chap 13 folder of your Student Data Files. 1c. Write a C++ program named weeklyPay.cpp to test your class Timeclock Your program should ask the user how many hours the user worked each day of the week. An object should be created for each day of the week with the number of hours for each...
Write a C++ program using four enumerators. Initialize each as follows: 1. first, second, third, fourth, fifth, sixth, seventh, eighth, ninth 2. Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday 3. curve, fast, knuckle, slider 4. single, double, triple, homer The program should prompt a user to input a character array or 4 numbers pertaining to each enumerator. Display help text to assists the user. The help text should display the smallest and largest possible valuesfor each inputted number. Validate the...
1) Write a MATLAB script to prompt a user to input two numbers, then assess whether the two numbers are equal or not. If the two numbers are equal, display that they are equal in the Command Window. If they are not equal, display that they are not equal in the Command Window. 2) Write a MATLAB script that prompts the user to enter the day of the week using the input function. If the information the user enters is...
JAVA Project Please have the code written in JAVA This is a game I am trying to develop. Please let me know if its possible and what the base code is. Prompt User “Hello! Welcome to the game.” Prompt User “To begin the game, please enter a letter” Random word generator, will set the String to a new word After the user inputs a letter, the computer will enter a loop Once in the loop the computer will test each...
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"....
Java code Guessing Game Refinement. (The user thinks of a
number and the program guesses it) Program should be able to guess
correctly in 7 tries or lower.
Initialize a variable that represents the lowest possible
number to 0 (what type should this be?)
Initialize a variable that represent the highest possible
number to 100 (what type should this be?)
Initialize a Boolean variable that represents if we’ve
achieved the correct guess to false
Initialize a variable in which to...