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
-Give a definition of the critical section problem and explain the purpose of the entry and exit code blocks
Alisiya [41]

Answer: In operating system a code segment which accesses  some shared variables or resources one at a time atomically such other no other code or process is accessing that resource or variable at the same time.

Entry section code block allows the access to the shared resource or variable and exit section code signals the termination from access to the shared resource or variable.

Explanation:

Entry and exit section codes needs to check certain properties before allowing the access and removal of access to a particular code segment.

These conditions are:

1. Bounded waiting.

2. Mutual exclusion.

3. checking thread execution status to allows other threads to enter the critical section (CS).

6 0
3 years ago
⚠️⚠️⚠️⚠️⚠️⚠️Help! What is not an advantage of using virtual machines?
Luda [366]

Answer:

It doesn’t take up any storage space on the physical machine.

Explanation:

The virtual machine does take up some storage space on the physical machine.

5 0
3 years ago
Task 1
EleoNora [17]

Answer: yes they do

Explanation: they both show the same references.

5 0
3 years ago
If you have a Gmail account, you automatically have a Google+ account
Korolek [52]
The statement above is TRUE.
According to Google operating system, new users who signed up for google account will automatically get a gmail and google plus accounts. User can later delete the google plus account if they are not interested in it.
5 0
3 years ago
Small-business owner Marcos set up his Google Ads campaign by thinking of “obvious” keywords off of the top of his head. What's
LiRa [457]

Answer:See the suggestions on the Opportunities tab

Explanation: The improvement in the Google ad can be made by the taking a look at the Opportunities tab which will display the adequate opportunities.

The tab displays these opportunities on the basis of the campaign settings, account's history, performance, style, trends etc and thus will create the appropriate opportunities accordingly.Thus Marcos will have to see the suggestion displayed on Opportunities tab

5 0
3 years ago
Other questions:
  • To join two or more objects to make a larger whole is to _____________ them.
    11·2 answers
  • Which css property is used to change the text color of an element?
    15·1 answer
  • The original commercial version of Ethernet supported 10 Mbps bandwidth; the version introduced in the early 1990s supports 100
    13·1 answer
  • To prevent unauthorized access and use, at a minimum a company should have a written __________ that outlines the activities for
    6·1 answer
  • What is not soured of income
    6·1 answer
  • .true or false? one disadvantage of cloudware is that it is never free<br> A. true<br> B. false
    12·1 answer
  • If you could pick xbox or playstation what would you pick?And why :)?
    11·2 answers
  • Which footing supports a long brick or concrete wall<br>​
    14·1 answer
  • Convert 105 decimal to 128 binary form
    5·1 answer
  • Why AI strategy is important?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!