How to design a program using Array's

Pages: 12
I have no clue what to look for or do next
I have no clue what to look for or do next

If you're unsure how to use functions, take the time to go through the tutorial page on the topic.
http://www.cplusplus.com/doc/tutorial/functions/

Since you appear to be struggling, the best way to improve is by actually compiling and running your own code, just reading alone isn't enough, it requires hands-on experience, get involved, write some code, see what happens.

If you do get stuck, then post the code you have written so far and post it here so we can see where the obstacles are and help you to overcome them.

The important thing is to approach the task in small steps. There's no need to have a complete all-singing all-dancing program as a first attempt. Start small and build up one stage at a time.
Indeed, indeed. First, try to implement the function I gave you, UgoChi. After you are able to implement the function to calculate cook time for the chicken, start building up. Create a function convert the time from minutes to hours. Build up from there.

-VX
Thank you @Chervil I'm looking at it as we speak
@UgoChi and don't forget to validate, that is major points in an entry level class
@BrandonStaab @VX0726 @Chervil this is the best I came up with as rough draft

Can you help me with assignment?

Please enter the weight of the Chicken
10
Cook Time Minutes = 10*20 + 15
Cook Time Minutes = 215
intHours = 3
intMinutes = 35

Function:Output:
The Cook Time in Minutes = 215 minutes
The Cook Time in Hours = 3 hours 35 minutes



Declare Weight as Integer = 0

Declare Cook_Min as Integer = 0

Declare Cook_Hr as Integer = 0

Declare Formula as String = “* 20 + 15”

Begin Program

Call Welcome

Call Calc

Call Output

End Program

Function Welcome

Write “Please enter the weight of the bird to be cooked: “

Input Weight

Write Weight

End Function

Function Calc(Weight)

Cook_Min = Weight * 20 + 15

Write “Cook Time Minutes = “+ Weight+Formula

Int_Min = Cook_Min

While Int_Min > 60

Int_Hr = Int_Hr + 1

Int_Min = Int_Min – 60

End While

Write “Int_Hr = “+Int_Hr

Write “Int_Min =”+Int_Min

End Function

Function Output(Int_Min, Int_Hr)

Write “Cook time in minutes = “+Cook_Min+” minutes”

Write “Total cooking time = “+Int_Hr+” hours “+Int_Min+” minutes”

End Function
I need a answer similar to that rough draft


This is original assignment:

Pseudocoding – Determining the Cook Time

Let’s imagine that you have been contacted by a local restaurant. It seems they are having some trouble with consistency and they need a program to help them determine exactly how long a chicken should cook. Your task is to design a program that would ask the user to input the weight of the chicken and then determine the appropriate cook time using a formula that will be given below. The oven temperature will remain constant so you don’t have to worry about that. For the purposes of this program, the cook time will be 20 minutes per pound plus an additional 15 minutes.

At the end of the program, you will display the “Cook Time Minutes” and the “Total Cook Time”.

This program design will use Functions for each of the key elements. Make sure to name each function appropriately.

THE PROGRAM SPECIFICS:

Function: The program should ask the user to input the weight of the bird rounded to the nearest pound.
The weight should be assigned to an appropriate named variable

For the purposes of this program, the cook time will be 20 minutes per pound plus an additional 15 minutes.

Function: The “Cook Time Minutes” should be calculated using the following mathematical formula
Cook Time Minutes = Weight * 20 + 15
The above formula calculates the total minutes that the chicken would be cooking.
Create a temporary variable called “intMinutes” and assign “Cook Time Minutes” to it.
If the “intMinutes” variable is more than 60, create a loop that will subtract 60 while adding 1 to the “intHours” variable. This loop should continue until the “intMinutes” is less than 60.

Function: Once calculated, display the cook time in total minutes (using “Cook Time Minutes”).
Also display the total cook time in hours and minutes (using “intHours” and “intMinutes”).
Topic archived. No new replies allowed.
Pages: 12