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
In Python which is the correct method to load a module math?
Wittaler [7]

Answer: The math module is a standard module in Python and is always available. To use mathematical functions under this module, you have to import the module using import math .

Explanation:

3 0
3 years ago
A continuous and differentiable function f(x) with the following properties: f(x) is decreasing at x=−5 f(x) has a local minimum
butalik [34]

The continuous and differentiable function where f(x) is decreasing at x = −5 f(x) has a local minimum at x = −2 f(x) has a local maximum at x = 2 is given as: y = 9x - (1/3)x³ + 3.

<h3>What is a continuous and differentiable function?</h3>

The continuous function differs from the differentiable function in that the curve obtained is a single unbroken curve in the continuous function.

In contrast, if a function has a derivative, it is said to be differentiable.

<h3>What is the solution to the problem above?</h3>

It is important to note that a function is differentiable when x is set to a if the function is continuous when x = a.

Given the parameters, we state that

f'(5) < 0; and

x = -5

The local minimum is given as:
x = -3;

the local maximum is given as

x = 3

Thus, x = -3 ; alternatively,

x = 3.  With this scenario, we can equate both to zero.

Hence,

x + 3 = 0;

3-x = 0.

To get y' we must multiply both equations to get:

y' = (3-x)(x + 3)

y'   = 3x + 9 - x² - 3x

Collect like terms to derive:

y' = 3x - 3x + 9 - x²; thus

y' = 9-x²

When y' is integrated, the result is

y = 9x - (x³/3) + c

Recall that

F (-5) < 0

This means that:

9 x -5 - (-5³/3) + c < 0
⇒ -45 + 125/3 + c <0
⇒ -10/3 + c < 0

Collecting like terms we have:
c < 10/3; and

c < 3.33


Substituting C into

f(x) = 9x - x³/3 + c; we have

f(x) = 9x - x³/3 + 3, which is the same as  y = 9x - (1/3)x³ + 3.

Learn more about differentiable functions at:
brainly.com/question/15047295
#SPJ1

7 0
2 years ago
How technology bacome the mode of revealing​
maria [59]

Answer:

afefdasf

Explanation:

3 0
3 years ago
The kitchen in any café is a noisy place. To make sure the orders which you have carefully written down on your notepad make it
Levart [38]

Answer:

file_name = 'orders.txt'

file_obj = open( file_name, 'r' )

lines = file_obj.read()

print(lines.upper(), end = '')

Explanation:

  • Define the name of the file .
  • Use the built-in open function to open the file in read mode .
  • Use the built-in read function to read the file and assign this to lines variable.
  • Finally display the lines by converting them to capital alphabets by using the built-in upper() function.
5 0
3 years ago
What are the components of a computer system
Snezhnost [94]

Answer:

The motherboard

Explanation:

3 0
3 years ago
Other questions:
  • How to turn a flash drive into a bluetooth adapter?
    13·1 answer
  • Write a program that will find the smallest, largest, and average values in a collection of N numbers. Get the value of N before
    13·1 answer
  • Which rule should be followed to stay safe online
    5·1 answer
  • What is the different between ethical and legal issues?​
    6·1 answer
  • Number Array Class
    5·1 answer
  • Discuss two basic types of monitors CRT and LCD give me in short ​
    9·2 answers
  • Assignment 4: Evens and Odds<br><br><br> How do I fix this?
    13·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    11·1 answer
  • Can someone find out what this binary number thing is. Just find out the message, I'm having a difficult time
    13·1 answer
  • 15 _____ 3 = 0 Question 11 options: a) / b) % c) * d) //
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!