| | |
Simple Program Design and Solution Algorithym
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
•
•
Join Date: Sep 2008
Posts: 2
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Jun 2006
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
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
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)
}![]() |
Other Threads in the Computer Science Forum
- Previous Thread: help to implement one step predictor
- Next Thread: Need Help with Scenario on Modellling Methods for Developing a Computer Program
Views: 1454 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Computer Science
ai algorithm algorithms amazon assignment assignmenthelp assignments automata battery binary bittorrent bizarre bletchleypark blogging bomb business cern codebreaker compiler computers computerscience computertrackingsoftware connect conversion csc data dataanalysis dataintepretation development dissertation dissertations dissertationthesis dissertationtopic ebook employment energy extensions floatingpoint foreclosure foreclosuresoftware gadgets geeks givemetehcodez graphics hardware history homeowners homework homeworkassignment homeworkhelp humor ibm idea internet iphone ipod itcontracts laws lazy linkbait lsmeans mainframes marketing mining mobileapplication msaccess nano networking news os p2p parser piracy piratebay principles programming rasterizer sam-being-cute sas science sex simulation software spoonfeeding sql stephenfry student study supercomputer supercomputing sweden technology textfield tree turing turingtest uk virus warehouse ww2






