1. Engineering
  2. Computer Science
  3. convet the following c program use the provided c program to...

Question: convet the following c program use the provided c program to...

Question details

Convet the following c++ program

  • Use the provided C++ program to write the Java code for the task
 

#include <iostream>

#include <iomanip>

 

using namespace std;

 

int main()

{

    double price;

    int quantity;

    double amount, vat, final_amount;

 

    cout << "Enter the price of the item: ";

    cin >> price;

    cout << "Enter the quantity that was bought: ";

    cin >> quantity;

 

    amount = price * quantity;

    vat = amount * 14.5/100;

    final_amount = amount + vat;

   

    cout << "The number of items bought is " <<quantity << endl;

    cout << "Price per item is R " << fixed <<setprecision(2) << price << endl;

   cout << "Amount is R " << amount << endl;

cout << "VAT amount is R " << vat << endln;

  cout << "Amount due is R " << final_amount << endl;

 

    return 0;

}

 

 

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution