Simple Program Design and Solution Algorithym

Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Reply

Join Date: Sep 2008
Posts: 2
Reputation: Kemper is an unknown quantity at this point 
Solved Threads: 0
Kemper Kemper is offline Offline
Newbie Poster

Simple Program Design and Solution Algorithym

 
0
  #1
Sep 8th, 2008
Need help with a problem. Pretty new to this kind of stuff.

You require an algorithm that will receive an integer from the screen, add 5 to it, double it , subtract 7 from it and display the final number.

Pretty much I am confused what I need to put in the input, processing and output.

Any help and explanations greatly appreciated
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 2
Reputation: Kemper is an unknown quantity at this point 
Solved Threads: 0
Kemper Kemper is offline Offline
Newbie Poster

Re: Simple Program Design and Solution Algorithym

 
0
  #2
Sep 8th, 2008
Thus far, I have came up with ...

Input - Would be Integer_1

Processing - Prompt for Integer_1

Output - Total.

After that I am lost.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,540
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 704
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Simple Program Design and Solution Algorithym

 
0
  #3
Sep 9th, 2008
What language are you doing this in?
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 5
Reputation: heathovc is an unknown quantity at this point 
Solved Threads: 0
heathovc heathovc is offline Offline
Newbie Poster

Re: Simple Program Design and Solution Algorithym

 
0
  #4
Nov 21st, 2008
Originally Posted by Kemper View Post
Need help with a problem. Pretty new to this kind of stuff.

You require an algorithm that will receive an integer from the screen, add 5 to it, double it , subtract 7 from it and display the final number.

Pretty much I am confused what I need to put in the input, processing and output.

Any help and explanations greatly appreciated
Well the first step would be to write down what happens, in a "this happens then that happens" format, such as:
1) Prompt the user for the number
2) Put that response into an input integer variable outside the method
3) Call the method/function and pass the integer variable in (by value) as a parameter
4) Have the method calculate and return the value to a result integer variable
5) Display that variable

The second step is to do some sample cases on scratch paper so you know what the expected output should be (in case you have errors in your math/processing).

Pseudocode would be something like this:
Prompt would be some predefined function that returns a value that the user entered
Integer inputValue = Prompt("Input Integer")
Integer finalValue = Calculate(inputValue)
Display finalValue in text format

Function Calculate(integerValue) Returns Integer
{
Return (((integerValue + 5) * 2) - 7)
}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC