Question

In: Computer Science

- Part 1 – 4 Debugging Exercises – there are things wrong – either logic or...

- Part 1 – 4 Debugging Exercises – there are things wrong – either logic or syntax errors.  Correct the pseudocode and one Java program. Add the corrected code in BOLD and change the corrected color to RED.  

Debugging 2:  Add the missing code in bold and red.

start

                  Declarations

                           num number

         

                  housekeeping()

                  while number >= 15

                           detailLoop()

                  endwhile

         

                  finish()    

stop

housekeeping()

         number = 1

return

detailLoop()

         output number

         num = number + 1

return

finishUp()

         output “End of program”

return

Solutions

Expert Solution

Ans)

Java Program

if your satisfy below answer please give positive rating or?

code

import java.util.Scanner;

public class Airline

{

            public static void main(String args[])

            {

                        Scanner s = new Scanner(System.in);

                        String passengerName = "" ;   

                        String ageString = "" ;

                        int passengerAge = 0 ;

                        System.out.println("Enter passenger's name: ");

                        passengerName  = s.nextLine();

                        System.out.println("Enter passenger's age: ");

                        ageString  = s.nextLine();

                        

                        passengerAge = Integer.parseInt(ageString) ;

                                                            

                        if(passengerAge <=6 || passengerAge == 65)

                        {

                           System.out.println("Passenger name: " + passengerName);                         

                           System.out.println("Passenger age : " + passengerAge);

                           System.out.println("This passenger is eligible for a 25% discount.");

                        }

                        else

                        {

                           System.out.println("Passenger name: " + passengerName);                         

                           System.out.println("Passenger age : " + passengerAge);

                           System.out.println("This passenger is not eligible for a 25% discount.");

                        }

                        System.exit(0);

            }

}

above execute and get output in below screen shot

Output

if your satisfy above answer please give positive rating or?

if any doubts below comment here

please don't dislike

Thankyou!


Related Solutions

Instructions:  Save this file as YourName_PracticeDebuggingTest. - Part 1 – 4 Debugging Exercises – there are things...
Instructions:  Save this file as YourName_PracticeDebuggingTest. - Part 1 – 4 Debugging Exercises – there are things wrong – either logic or syntax errors.  Correct the pseudocode and one Java program. Add the corrected code in BOLD and change the corrected color to RED.   Part 1 Debugging 1:  Add the missing code in bold and red. start          Declarations                                     num firstNum                                     num secondNum                                     string MSG = “Got it!”                   housekeeping()                   detail()                   finish()          stop          housekeeping()                   output “Enter three numbers: ”                   input firstNum, thirdNum          return          detail()                   if...
Chapter 6 Debugging Exercises - Problem 1 The programmer intends for this pseudocode to display three...
Chapter 6 Debugging Exercises - Problem 1 The programmer intends for this pseudocode to display three random numbers in the range of 1 through 7. According to the way we've been generating random numbers in the book; however, there appears to be an error. Assume that the random() function is a built-in library function. Correct the pseudocode so that the program works as it should (This has 1 error and is easy to spot) //This program displays 3 random numbers...
For each of the following exercises 1 to 4: For each test use either the critical...
For each of the following exercises 1 to 4: For each test use either the critical value or the P-value method you are not required to use both. State the claim and the hypothesis. Find the critical value(s) and describe the critical (rejection) region You can choose to use the P-value method in this case state the P-value after the test value. Compute the test value (statistic) Make a decision Summarize the results (conclusion The department of transportation in a...
part a. In class we learned that the debugger, and _________ are effective in debugging C++...
part a. In class we learned that the debugger, and _________ are effective in debugging C++ programs. a. a logic analyzer b. print statements c. code reviews d. network analyzers part b. A ‘side-effect’ is a. code written in a memory-efficient way b. a style of writing C++ statements that is risky. c. code written so that more than one thing is being done in one statement. d. (a) and (b) e. (b) and (c) f. none of the above...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data.  .  You are NOT trying to find mistakes. Use this textbox to explain the pseudocode/ code intent. Include any test data used: What does this do? Desk Checking #4:  Explain the intent of this code.  Be as specific as possible.   List the data you use for example...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data.  .  You are NOT trying to find mistakes. What does this do? Desk Checking #2:  Explain the intent of this pseudocode.  Be as specific as possible. List the data you use as the example data. Use this textbox to explain the pseudocode/ code intent. Include any test...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data.  .  You are NOT trying to find mistakes What does this do? Desk Checking #3:  Explain the intent of this pseudocode.  Be as specific as possible.   List the data you use for example data. Use this textbox to explain the pseudocode/ code intent. Include any test data...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are...
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data.  .  You are NOT trying to find mistakes. What does this do? Desk Checking #1:  Explain the intent of this pseudocode. List the data you use as the example data. start                   Declarations          num balance Use this textbox to explain the pseudocode/ code intent. Include any test...
Discuss Two things that can go wrong in program development
Discuss Two things that can go wrong in program development
Programming language to be used: Java Exercises Part 1) The Dog Class In the first part...
Programming language to be used: Java Exercises Part 1) The Dog Class In the first part of the lab, we are writing a class to represent a Dog. It should not have a main method. Dog needs fields for price (to purchase the dog), breed, name, and age. Use appropriate data types The class should have the following two kinds of Constructors: Constructor 1: Write a constructor that accepts a value for each of the fields Constructor 2: Write a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT