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...
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:...
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 =...
Write a program that prompts the user to input a string and outputs the string in...
Write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use dynamic arrays to store the string.) my code below: /* Your code from Chapter 8, exercise 5 is below. Rewrite the following code to using dynamic arrays. */ #include <iostream> #include <cstring> #include <cctype> using namespace std; int main() { //char str[81]; //creating memory for str array of size 80 using dynamic memory allocation char *str = new char[80]; int len;...
Create a Python main program which calls two functions enterNum and calcResult and accomplishes the following:...
Create a Python main program which calls two functions enterNum and calcResult and accomplishes the following: 1. The main program calls the function enterNum 3 times. The first time enterNum is called, the main program stores the returned output in the variable xx. The second time, the returned output is stored in the variable yy and the third time in zz. 2. enterNum asks the user to enter a floating point number. This function has no input arguments and returns...
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; }
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>...
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 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.