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
n200080 [17]
3 years ago
13

In Java please:

Computers and Technology
2 answers:
topjm [15]3 years ago
6 0

Answer:

import java.util.Scanner;

public class Supermarket

{

public static void main (String[] args)

{  

String item;

double pounds, ounces, price,

total, unit;

Scanner scn = new Scanner(System.in);

System.out.print("Please enter the name of item ");

item = scn.nextLine();

System.out.print("Please enter the price of "  + "the item per pound : ");

price = scn.nextDouble();

System.out.print("Enter the weight of "  + "the item in pounds and "  + "ounces respectively : ");

pounds = scn.nextDouble();

ounces = scn.nextDouble();

unit = price/16;

total = price * (pounds + ounces/16);

System.out.print("The unit price of "  + "the products sold is : "  + unit);

System.out.print("\nThe total cost of the "  + "amount purchased is : "  + total);

}

}

Explanation:

  • Ask the user to enter the price of  the item and the weight.
  • Calculate the unit and the total price.
  • Display the unit and the total price.

Nadusha1986 [10]3 years ago
6 0
<h2>Answer:</h2>

//Import the Scanner class to allow for user's input

import java.util.Scanner;

//Create the class declaration

public class SuperMarket {

   //Write the main method

   public static void main(String[] args) {

       //Create an object of the Scanner class

       //to read in user's input

       Scanner input = new Scanner(System.in);

       

       //Declare all variables with their correct types

       String ItemName;

       double Pounds, Ounces, PoundPrice, TotalPrice, UnitPrice;

       

       //Prompt the user to enter all details one after the other

       //Receive the inputs and store in the right variables

       System.out.println("Please enter the item name");

       ItemName = input.nextLine();

       

       System.out.println("Please enter the price of the item per pound");

       PoundPrice = input.nextDouble();

       

       System.out.println("Please enter the weight of the item in pounds");

       Pounds = input.nextDouble();

       

       System.out.println("Please enter the weight of the item in ounces");

       Ounces = input.nextDouble();

       

       

       //Calculate the unit price using the given formula

       UnitPrice = PoundPrice / 16;

       

       //Calculate the total price using the given formula

       TotalPrice = PoundPrice * (Pounds + Ounces / 16);

       

       //Print out the results as follows;

       System.out.println("Item Name : " + ItemName);

       System.out.println("Unit Price : " + UnitPrice);

       System.out.println("Total Price : " + TotalPrice);

       

       

   }           //End of main method

   

}               //End of class declaration

===========================================================

<h2>Sample Output:</h2>

>> Please enter the item name

Biscuit

>> Please enter the price of the item per pound

780

>> Please enter the weight of the item in pounds

67

>> Please enter the weight of the item in ounces

90

>> Item Name : Biscuit

>> Unit Price : 48.75

>> Total Price : 56647.5

=============================================================

<h2>Explanation:</h2>

The above code has been written in Java and it contains comments explaining every line of the code. Please go through the comments carefully.

The actual lines of code in the program have been written in bold face to differentiate it from comments.

A sample output has also been given.

You might be interested in
To include all fields in a sql query, use the ____ symbol after the word select.
dolphi86 [110]
SQL is a standard language for storing, manipulating and retrieving data in databases and t<span>he SELECT statement is used to select data from a database.</span>
To include all fields in a SQL query, use the * symbol after the word select. The symbol * is used after the word SELECT. This way it indicates that you want to include all fields in the query results in the order in which you described them to the DBMS when you created the table.​
4 0
4 years ago
a one-two paragraph summary on the Running Queries and Reports tutorials. Apply critical thinking and an academic writing style
masha68 [24]

Explanation:

Both perform almost the same function of storing data, performing numerical calculations, formating cells, and to generate reports.

However, when dealing with data that is short term (requiring less updating) Microsoft Excel is recommended as it provides easy spreadsheet functions. Access on the other hand is a more complex application for data analysis involving constantly changing data values that are long term based. Access allows for efficient data analysis using complex tools such as import module, automated queries etc.

8 0
3 years ago
"The effectiveness of memory retrieval is directly related to the similarity of cues present when the memory was encoded to the
alexdok [17]

Answer:

D

Explanation:

Cause You Have To Decode It To Get To The Memory In The First Place

3 0
3 years ago
_____ is the software that protects you computer from harmful files, Trojan horses, and worms.
Bumek [7]
I think it's antivirus because Antivirus means to protect your computer from a deadly virus
4 0
4 years ago
Read 2 more answers
What is the output of the following C++ program?
KIM [24]

Answer:

Output:<em> </em><em>15 11/16 inches</em>

Explanation:

#include <iostream>

using namespace std;

////////////////////////////////////////////////////////////////////////

class InchSize {

public:

   InchSize(int wholeInches = 0, int sixteenths = 0);

   void Print() const;

   InchSize operator+(InchSize rhs);

   

private:

   int inches;

   int sixteenths;

};

InchSize InchSize::operator+(InchSize rhs) {

   InchSize totalSize;

   totalSize.inches = inches + rhs.inches;

   totalSize.sixteenths = sixteenths + rhs.sixteenths;

   

   // If sixteenths is greater than an inch, carry 1 to inches.

   if (totalSize.sixteenths >= 16) {

       totalSize.inches += 1;

       totalSize.sixteenths -= 16;

   }

   return totalSize;

}

InchSize::InchSize(int wholeInches, int sixteenthsOfInch) {

   inches = wholeInches;

   sixteenths = sixteenthsOfInch;

}

void InchSize::Print() const {

   cout<<inches<<" "<<sixteenths<<"/16 inches"<<endl;

}

////////////////////////////////////////////////////////////////////////

int main() {

   InchSize size1(5, 13);

   InchSize size2(9, 14);

   InchSize sumSize;

   sumSize = size1 + size2;

   sumSize.Print();

   return 0;

}

////////////////////////////////////////////////////////////////////////

sumSize variable was printed in the end. Print() prints the calling object's inches and sixteenths variables' values.

sumSize's inches is equal to size1 plus size2's inches.

Because the sum of sixteenths was greater than 16, sumSize's sixteenth was decreased by 1 and inches was increased by 1.

3 0
4 years ago
Other questions:
  • Using the CPI to calculate the inflation rate​ _______________ the underlying inflation​ rate, and using the core inflation rate
    7·2 answers
  • Physical access, security bypass, and eavesdropping are examples of how access controls can be ________.
    15·1 answer
  • How does scarcity affect what gets produced
    5·1 answer
  • My 2 in 1 laptop/tablet
    13·1 answer
  • Discuss some design considerations that you should keep in mind when you want to design a professional-looking flyer or newslett
    5·2 answers
  • From the following list choose all the tasks an operating system performs.
    5·2 answers
  • What year did Forethought, Inc. release version 1.0 of PowerPoint
    13·1 answer
  • Using complete sentences post a detailed response to the following.
    13·1 answer
  • Explain the application software and utility software in detail​
    15·1 answer
  • How do I find unwanted programs on my computer?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!