1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IceJOKER [234]
2 years ago
14

Task #3 Debugging a Java Program

Computers and Technology
1 answer:
ollegr [7]2 years ago
4 0

Answer:

import java.util.Scanner;

public class SalesTax

{

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;

total = 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);

}

}

Explanation:

You might be interested in
Question: 4/8
Gemiola [76]

The generated test cases for the function assuming another developer coded the function is given below in a C++ program.

<h3>THE CODE</h3>

#include <iostream>  

#include <iomanip>

#include <string>

using namespace std;

// define the data type "triangletype" with {values}

enum triangleType { scalene, isosceles, equilateral, noTriangle };

// Prototype function which returns the position of triangleType{value}

// Example: Scalene = 0, isosceles = 1, etc. These are zero indexed.

triangleType triangleShape(double a, double b, double c);

// Prototype function which takes the integer value of the

// triangle type and outputs the name of triangle

string shapeAnswer(int value);

int main() {

   double inputA;

   double inputB;

   double inputC;

   cout << "To determine whether a triangle is either:" << endl;

   cout << setw(50) << " - Scalene" << endl; // Unequal in length

   cout << setw(52) << " - Isosceles" << endl; // Two sides equal length

   cout << setw(54) << " - Equilateral" << endl; // All sides equal

   cout << setw(57) << " - Not a triangle" << endl;

   cout << "Enter side A: ";

   cin >> inputA;

   cout << "Enter side B: ";

   cin >> inputB;

  cout << "Enter side C: ";

   cin >> inputC;

   cout << "The triangle is " << shapeAnswer(triangleShape(inputA, inputB, inputC)) << endl;

}

triangleType triangleShape(double a, double b, double c) {

   triangleType answer;

   if ( c >= (a + b) || b >= (a + c) || a >= (b + c) ) {

       answer = noTriangle;

   }

   else if (a == b && b == c) {

       answer = equilateral;

   }

   // Test the 3 options for Isosceles equality

   else if ( (a == b) && (a != c) || (b == c) && (b != a) || (a == c) && (a != b) ) {

       answer = isosceles;

   }

   else {

       answer = scalene;

   }

   return answer;

}

string shapeAnswer(int value) {

   string answer;

  switch (value) {

   case 0:

       answer = "Scalene";

       break;

   case 1:

       answer = "Isosceles";

       break;

   case 2:

       answer = "Equilateral";

       break;

   case 3:

       answer = "Not a triangle";

       break;

   default:

       break;

   }

   return answer;

}

Read more about C++ programs here:

brainly.com/question/20339175

#SPJ1

8 0
1 year ago
In designing input by clinicians for an EHR system, which of the following would be effective for a clinician when the data are
svetoff [14.1K]

Answer:

Speech recognition

Explanation:

Speech recognition would be effective for a clinician when data entry is fairly repetitive and the vocabulary used is fairly limited and over time it as become a replacement for other forms of dictation.

3 0
3 years ago
What does spyware do on your computer?
Morgarella [4.7K]
It's a malware, and it basically let's the person/hacker/culprit get information off your computer without the owner of the computer knowing that the person is doing it. It's often used to find keystrokes, passwords, online interaction, and other personal data.
5 0
3 years ago
What is the outcome of using the formula =AVERAGE(A12:A20)?
balu736 [363]
Well according to the name of the function, I would say <span>A) the mean value of a set of numbers</span>
6 0
3 years ago
Read 2 more answers
What controls a computer's basic operations?
S_A_V [24]
 Basic Computer Operations. Input: Information and programs are entered into the computer through Input devices such as the keyboard, disks, or through other computers via network connections or modems connected to the Internet. The input device also retrieves information off disks.
3 0
3 years ago
Other questions:
  • The checksum doesn't compute for a packet sent at the Internet Protocol (IP) level. What will happen to the data?
    14·1 answer
  • What does FTP stand for?
    15·2 answers
  • true or false manual handling of materials accounts for the primary source of energy in the workplace
    13·2 answers
  • What might a programming prefer the top-down approach to programming design?
    10·1 answer
  • If some1 emails u and u want to know who it was how do u find that out
    10·2 answers
  • Write a SELECT statement that returns a single value that represents the sum of the largest unpaid invoices submitted by each ve
    5·1 answer
  • How can you relate the careers in Finance as BSIS students?
    15·1 answer
  • Multiple choice:
    12·2 answers
  • Sara wants to set up her lights to turn on when she arrives home. She has heard that she might be able to do this using IoT. Wha
    12·2 answers
  • 8. Give regular expressions with alphabet {a, b} for
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!