Question

debug the following 1) // The main program calls a method that // prompts for and...

debug the following

1)

// The main program calls a method that
// prompts for and returns a name
start
Declarations
string usersName
name = askUserForName()
output "Your name is ", usersName
stop

string askUserForName()
Declarations
string name
output "Please type your name "
input usersName
return

2)

// The main program passes a user’s entry to
// a method that displays a multiplication table
// using the entered value. The table includes the
// value multiplied by every factor from 2 through 10.
start
Declarations
num usersChoice
output "Enter a number "
input usersChoice
multiplicationTable(choice)
stop

void multiplicationTable(num value)
Declarations
num LOW = 2
num HIGH = 10
num x
num answer
x = LOW
while x <= HIGH
answer = value * num
output value, " times ", x, " is ", answer
x = answer + 1
endwhile
return answer

3)

// The main program prompts a user for a Social
// Security number, name, and income, and then
// computes tax. The tax calculation and the output
// of the taxpayer’s report are in separate modules.
// Tax rates are based on the following table:
// Income ($)   Tax rate (%)
// 0–14,999   0
// 15,000–21,999   15
// 22,000–39,999   18
// 40,000–69,999   22
// 70,000–99,999   28
// 100,000 and up   30
start
Declarations
string socSecNum
string name
num income
num taxDue
output "Enter Social Security number "
input socSecNum
while socSec <> "0"
output "Enter name "
input name
output "Enter annual income "
input income
taxDue = taxCalculations()
output taxReport(socSecNum, name, taxDue)
output "Enter Social Security number or 0 to quit "
input socSecNum
endwhile
stop

Homework Answers

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The assignment below has three pseudocodes below I need to fix the debug exercises in it....
The assignment below has three pseudocodes below I need to fix the debug exercises in it. Please help. Thanks. Highlight or mark in bold the corrections. Thanks! //DEBUG06-01 // A high school is holding a recycling competition, // and this program allows a user to enter a student's // year in school (1 through 4) and number of cans collected // for recycling. Data is entered continuously until the user // enters 9 for the year. // After headings, output...
Please provide answer in the format that I provided, thank you Write a program that prompts...
Please provide answer in the format that I provided, thank you Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str=”There”, then after removing all the vowels, str=”Thr”. After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel. You must...
is there anything wrong with the solution. the question are from java course Write a main...
is there anything wrong with the solution. the question are from java course Write a main method that will request the user to enter Strings using a JOptionPane input dialog. The method should continue accepting strings until the user types “STOP”.       Then, using a JOptionPane message dialog, tell the user how many of the strings begin and end with a digit. Answer: import javax.swing.*; public class IsAllLetters {     public static void main(String[] args) {         String input;         int count =...
The City of Atlanta is holding a special census. The census takers collect one record for...
The City of Atlanta is holding a special census. The census takers collect one record for each resident. Each record contains a resident’s age, gender, and voting district. The voting district field contains a value between 1 and 22. The program will accept resident information until a sentinel value is entered. At the end, the program will produce a list of districts and the count for each district. Given the following pseudocode, fill in the missing lines of code: (Grading:...
In the main(), below, write a program that prompts for (1) how many values to sum,...
In the main(), below, write a program that prompts for (1) how many values to sum, and then (2) uses a summing loop to prompt for and add up 5 numbers. #include <iostream> #include <iomanip> using namespace std; int main() {     < your answer goes here> return 0; }
In C++ Please, In the main(), below, write a program that prompts for (1) how many...
In C++ Please, In the main(), below, write a program that prompts for (1) how many values to sum, and then (2) uses a summing loop to prompt for and add up 5 numbers. #include <iostream> #include <iomanip> using namespace std; int main() { < your answer goes here> return 0; }
Write a program containing a function, reverseDigit, that takes an integer as a parameter and returns...
Write a program containing a function, reverseDigit, that takes an integer as a parameter and returns the number with its digits reversed, then printout the return result. For example, the value of reverseDigit(12345) is 54321; the value of reverseDigit(5600) is 65; the value of reverseDigit(7008) is 8007; and the value of reverseDigit(-532) is -235.    Modify the following program to make a correct output. /* // Name: Your Name // ID: Your ID // Purpose Statement: ~~~ */ #include <iostream>...
Write a program that prompts the user to enter an integer number between 1 and 999....
Write a program that prompts the user to enter an integer number between 1 and 999. The program displays the sum of all digits in the integer if the input is valid; otherwise, it displays a message indicating that the integer is not between 1 and 999 and hence, is invalid. Name the program file Q1.cpp Example: if the user enters 12, sum of digits is 3. If the user enters 122, sum of digits is 5.
Write a C program that prompts the user to enter a line of text on the...
Write a C program that prompts the user to enter a line of text on the keyboard then echoes the entire line. The program should continue echoing each line until the user responds to the prompt by not entering any text and hitting the return key. Your program should have two functions, writeStr and readLn, in addition to the main function. The text string itself should be stored in a char array in main. Both functions should operate on NUL-terminated...
Write a Python program that splits, doubles, and reverse each input string entered. For each string,...
Write a Python program that splits, doubles, and reverse each input string entered. For each string, split it at the given integer, and then output it in format as shown below. Convert all stings entered to uppercase for output. Assume string length is greater than the split value. Refer to the sample output below. Sample Runs: Enter a string: holiday Enter the number to split on: 3 HOL-YADI-LOH-IDAY Enter a string: TATTARRATTAT Enter the number to split on: 6 TATTAR-TATTAR-RATTAT-RATTAT...