Question

In: Computer Science

Find the Bug - Looking for at least 3 bugs! USE SOME METHOD TO SHOW ME...

Find the Bug - Looking for at least 3 bugs! USE SOME METHOD TO SHOW ME YOUR "FIXED CODE" ( type it in Red or highlight in yellow or use // at the end of the line) Your downloadable files for Chapter 1 include DEBUG02-01 Each file starts with some comments ( lines that begin with two slashes ) that describe the program. Examine the pseudocode that follows the introductory comment, then find and correct all the bugs. Click here for Debug0201.docxPreview the document Complete your answer in Word, Save it, and upload it into the assignment.

Debug0201

// This pseudocode segment is intended to compute and display

// the average grade of three tests

start

   Declarations

      num test1

      num test2

      num test2

      num average

   output "Enter score for test 1 "

   input test1

   output "Enter score for test 2 "

   input test2

   output "Enter score for test 3 "

   input test3

   average = test1 + test2 + test3 / 3

   output "Average is ", answer

end

Solutions

Expert Solution

Here is the answer...

// This pseudocode segment is intended to compute and display

// the average grade of three tests

start

   Declarations

      num test1

      num test2

      num test3

double average //it should be double or float

output "Enter score for test 1 "

   input test1

   output "Enter score for test 2 "

   input test2

   output "Enter score for test 3 "

   input test3

   average = ( test1 + test2 + test3 ) / 3

   output "Average is ", average

end

Sample CODE and OUTPUT:

import java.util.*;
class Average
{
   public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       int test1;
       int test2;
       int test3;
       double average;

       System.out.println("Enter score for test 1");
       test1 = sc.nextInt();

       System.out.println("Enter score for test 2");
       test2 = sc.nextInt();

       System.out.println("Enter score for test 3");
       test3 = sc.nextInt();

       average = (test1 +test2 + test3) / 3;

       System.out.println("Average is"+average);

   }
}

If you have any doubts please COMMENT..

If you understand the answer please give THUMBS UP..


Related Solutions

10. The data show the bug chirps per minute at different temperatures. Find the regression​ equation,...
10. The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting the first variable be the independent​ (x) variable. Find the best predicted temperature for a time when a bug is chirping at the rate of 3000 chirps per minute. Use a significance level of 0.05. What is wrong with this predicted​ value? Chirps in 1 min   Temperature (°F) 985        83.8 1087      85.2 867        74.7 1060      83.2 764        64.9 807        65.5 What is the...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting the first variable be the independent​ (x) variable. Find the best predicted temperature for a time when a bug is chirping at the rate of 3000 chirps per minute. Use a significance level of 0.05. What is wrong with this predicted​ value? Chirps in 1 min 1242, 1034, 1171, 799, 1217, 1060 Temperature ​(degrees​F) 92.9, 77.2, 87, 73.7, 95.3, 80.1 What is the regression​...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting the first variable be the independent​ (x) variable. Find the best predicted temperature for a time when a bug is chirping at the rate of 3000 chirps per minute. Use a significance level of 0.05. What is wrong with this predicted​ value? Chirps in 1 min 1133 1037 1230 854 1157 894 Temperature ​(degrees°​F) 85.4 86.6 92.1 74.2 85.5 79.5 What is the regression​...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting the first variable be the independent​ (x) variable. Find the best predicted temperature for a time when a bug is chirping at the rate of 3000 chirps per minute. Use a significance level of 0.05. What is wrong with this predicted​ value? Chirps in 1 min 810 1149 841 1013 863 930 Temperature ​(degrees​F) 68.2 88.3 73.5 84.6 75.6 74.3 What is the regression​...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting the first variable be the independent​ (x) variable. Find the best predicted temperature for a time when a bug is chirping at the rate of 3000 chirps per minute. Use a significance level of 0.05. What is wrong with this predicted​ value? Chirps in 1 min 758 1226 1021 1221 1182 1178 Temperature ​(degrees°​F) 65.1 92.8 84.3 94.9 85.5 91.2 What is the regression​...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting the first variable be the independent​ (x) variable. Find the best predicted temperature for a time when a bug is chirping at the rate of 3000 chirps per minute. Use a significance level of 0.05. What is wrong with this predicted​ value? Chirps in 1 min 1242, 1034, 1171, 799, 1217 ,1060 Temperature ​(degrees​F) 92.9, 77.2, 87, 73.7, 95.3, 80.1 What is the regression​...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting...
The data show the bug chirps per minute at different temperatures. Find the regression​ equation, letting the first variable be the independent​ (x) variable. Find the best predicted temperature for a time when a bug is chirping at the rate of 3000 chirps per minute. Use a significance level of 0.05. What is wrong with this predicted​ value? Chirps in 1 min: 955 1190 1206 804 1230 770 Temp F : 82.5 86.3 87.4 74.7 90.9 70.2 A) What is...
Use Heun's method to find the value of x at t=3 (assume the change in t=3)....
Use Heun's method to find the value of x at t=3 (assume the change in t=3). The ode is: (d^2x)/(dt^2)+(.3dx/dt)-4x=0. And the initial conditions are: x(0)=1, dx/dt (0)=0.
Manufacturing Technology 1. Find out at least 3 types method to produce for powder technology 2....
Manufacturing Technology 1. Find out at least 3 types method to produce for powder technology 2. Hot Pressing Forming(HPF) (i) What is that (ii) How its work 3. What mean by surface energy in sintering 4. What do you mean by inpregnated and infiltration
Use the method of Undetermined Coefficients to find a general solution of this system X=(x,y)^T Show...
Use the method of Undetermined Coefficients to find a general solution of this system X=(x,y)^T Show the details of your work: x' = 6 y + 9 t y' = -6 x + 5 Note answer is:  x=A cos 4t + B sin 4t +75/36; y=B cos 6t - A sin 6t -15/6 t
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT