Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Programming help (pseudocode flow chart and raptor)

pseudocode

  • Please log in to reply
4 replies to this topic

#1 cming21

cming21

    CC Lurker

  • New Member
  • Pip
  • 7 posts
  • Learning:C, C++, Objective-C, (Visual) Basic, JavaScript, Others

Posted 09 September 2012 - 02:11 AM

Hello,

I understand this site is not here to help with homework but I am stuck and this is my first programming class.

Here is the question. Below the question is the answer to part one, I need help with part 2 and 3. I understand that the text book exampless are not in here but my answer should help you understand what I need. Please give me some help.

Thank you so much.
  • Using a similar approach as example 3.6 (textbook page 147): “A new Car Price Calculator”, provide your analysis for the following problem statement:

Write a program to compute the income tax due on a taxable income entered by the user. Please refer to Programming Problem 5 (Pg. 162) for the details of this program.
Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to include what is the required output? What is the necessary input and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe the necessary formulas and sample calculations that might be needed.

2. Using a similar approach as example 3.6 (textbook page 147): “A new Car Price Calculator”, provide your program design for the program you analyzed from Step 1. Be sure to describe the fundamental tasks (i.e., things your program must do) needed to solve the problem so you can use a modular design. Provide pseudocode of your overall design that includes the Main module and the order of the module calls (see page 148 for an example), a Hierarchy chart (see figure 3.8 page 148), and flow chart (Raptor only). Finally, list all of your pseudocode for each module. (See pages148-151 as an example.)

Include header and step comments in your pseudocode, using a similar approach as the example provided in section 2.3 (textbook page 86). See example 2.8 on pages 87-88).

Prepare at least 5 sets of input data (Test data) along with their expected output for testing your program.Your test data can be presented in the form of a table as was shown in Assignment 1. Be sure that you provide expected output for each test case.

Here is my answer to part 1.

[Tax Table]

From To Tax due
$0 $50,000 $0 + 5% of amount over $0

$50,000 $100,000 $2,500 + 7% of amount over $50,000

$100,000 ... $6,000 + 9% of amount over $100,000
Program
Declare Public Class tax
Declare Public Property INCOME As Integer;
Declare Public Property TAXDUE As Float With Precision 2, Size 3;

Declare Public Method NEW(income As Integer = 0)
this.INCOME = income;
this.TAXDUE = 0.00
End Public Method NEW

Declare Public Method COMPUTETAX
If this.INCOME Is Less Than Or Equal To 50000 Then
this.TAXDUE = this.INCOME * 0.05;
Else If this.Income Is Less Than Or Equal To 100000 Then
this.TAXDUE = (this.INCOME * 0.07) + 2500;
Else
this.TAXDUE = (this.INCOME * 0.09) + 6000;
End If
End Public Method COMPUTETAX

End Public Class


BEGIN main program BEGIN
Use Class tax;
Declare input As Integer;
Declare taxtotal As Float With Precision 2, Size 3

Do
Prompt "Input a salary (enter 0 To exit): " + Line Break;
input = User Input;
Declare salary As New tax(input);
taxtotal = salary.COMPUTETAX;
Output "The tax for salary of " + input + " is " + taxtotal + Line Break;
Loop While input Is Not Equal To 0

END main program END
  • 0

#2 cming21

cming21

    CC Lurker

  • New Member
  • Pip
  • 7 posts
  • Learning:C, C++, Objective-C, (Visual) Basic, JavaScript, Others

Posted 09 September 2012 - 05:06 AM

Any help at all. I have to turn this in soon.
  • 0

#3 crokett

crokett

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 109 posts
  • Programming Language:C#, Perl
  • Learning:C#, Perl, Transact-SQL

Posted 09 September 2012 - 06:28 AM

that looks like VB? If so, this is the C# forum. You might get more help in the VB forum. That being said, any program I ever wrote started with some sort of design first, even if it was designed on a napkin at a bar - and some were, when I was in college. ;)

How come the examples from your book don't give you what you need?
  • 0

#4 cming21

cming21

    CC Lurker

  • New Member
  • Pip
  • 7 posts
  • Learning:C, C++, Objective-C, (Visual) Basic, JavaScript, Others

Posted 09 September 2012 - 08:44 AM

that looks like VB? If so, this is the C# forum. You might get more help in the VB forum. That being said, any program I ever wrote started with some sort of design first, even if it was designed on a napkin at a bar - and some were, when I was in college. ;)

How come the examples from your book don't give you what you need?

that looks like VB? If so, this is the C# forum. You might get more help in the VB forum. That being said, any program I ever wrote started with some sort of design first, even if it was designed on a napkin at a bar - and some were, when I was in college. ;)

How come the examples from your book don't give you what you need?


I dont understand the examples in the book. I am doing this class online and the teacher is not much help.
  • 0

#5 crokett

crokett

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 109 posts
  • Programming Language:C#, Perl
  • Learning:C#, Perl, Transact-SQL

Posted 09 September 2012 - 09:03 AM

Here's an example of a hierarchy chart.

http://cnx.org/content/m18682/latest/

I imagine you would start with your main() method at the top, then flow that down into all the other methods that do the work., So look at that chart and replace the names in the boxes with the names of your methods. You might need to redraw the connectors. The hierarchy chart shows relationships between all the methods and classes.

Here's a flow chart. The difference is the flow chart is much more linear and actually shows the logic if your program, normally without giving any details on the implementation
http://homepage.cs.u...s/Reading13.htm

Pseudo-code is fake code. It won't compile but it is enough to give someone and understanding of what your program does
  • 0





Also tagged with one or more of these keywords: pseudocode

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download