subject

Task #3 Debugging a Java Program 1. Copy the file Sales Tax. java (see Code Listing 1.2) from the Student CD or as directed by your instructor.
2. Open the file in your IDE or text editor as directed by your instructor. This file contains a simple Java program that contains errors. Compile the program. You should get a listing of syntax errors. Correct all the syntax errors, you may want to recompile after you fix some of the errors.
3. When all syntax errors are corrected, the program should compile. As in the previous exercise, you need to develop some test data. Use the chart below to record your test data and results when calculated by hand.
4. Execute the program using your test data and recording the results. If the output of the program is different from what you calculated, this usually indicates, a logic error. Examine the program and correct any logic errors. Compile the program and execute using the test data again. Repeat until all output matches what is expected?
Item Price Tax Total (calculated) Total (output)
Code Listing 1.2 (SalesTax. java)
import java. util. Scanner; // Needed for the Scanner class
/**
This program calculates the total price which includes sales tax.
*/
public class Sales Tax
{
public static void main(String[] args)
{
// Identifier declarations
final double TAX_RATE = 0.055;
double price;
double tax
double total;
String item;
// Create a Scanner object to read from the keyboard.
Scanner keyboard = new Scanner(System. in); ");
// Display prompts and get input.
System. out. print("Item description:
item= keyboard. nextLine();
System. out. print("Item price: $");
price - keyboard. nextDouble();
// Perform the calculations.
tax = price + TAX_RATE;
totl - price* tax;
// Display the results.
System. out. print (item + " $");
System. out. println(price);
System. out. print("Tax $");
System. out. println(tax);
System. out. print("Total $");
System. out. println (total);
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:30
Which of the following statements best describes it careers?
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
Which location-sharing service offers items for users as a gaming component and also allows them to collectively link their check-ins to publish a trip? a. whrrl b. buzzd c. foursquare (this option is wrong i already tried) d. gowalla for plato
Answers: 2
question
Computers and Technology, 23.06.2019 01:20
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
You know the right answer?
Task #3 Debugging a Java Program 1. Copy the file Sales Tax. java (see Code Listing 1.2) from the S...
Questions
question
English, 29.07.2019 03:10
question
Mathematics, 29.07.2019 03:10
question
Mathematics, 29.07.2019 03:10
question
Mathematics, 29.07.2019 03:10
Questions on the website: 13722367