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
Alborosie
3 years ago
5

Write a Java program to accept an item's name and price from the user and output them to the console

Computers and Technology
1 answer:
Anit [1.1K]3 years ago
6 0

Answer:

// program in java.

// package

import java.util.*;

// class definition

class Main

{// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read inputs

Scanner scr=new Scanner(System.in);

 // variables

String name;

   double price;

   System.out.print("Enter item's name: ");

   // read item's name

   name = scr.next();

   System.out.print("Enter item's price: ");

   // read item's price

   price= scr.nextDouble();

   // print name

   System.out.println("name of item is:"+name);

   // print price

   System.out.println("price of item is:"+price);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read name & price of item from user and assign it to variables "name" & "price" respectively with scanner object.Then print the name and price of item .

Output:

Enter item's name: Apple                                                                                                  

Enter item's price: 100                                                                                                    

name of item is:Apple                                                                                                      

price of item is:100.0

You might be interested in
1.-  POR QUE LOS HUMANOS NOS INTERESAMOS EN ROBOTS CONASPECTO HUMANO?
oksian1 [2.3K]

Answer:

........

Explanation:

s

6 0
3 years ago
Distinguish between a computer drive and computer driver​
rewona [7]

Answer:

The word Drive typically refers to a mechanical hard drive or solid-state hard drive used to store the OS, data and programs. A driver is software code that interfaces the various devices in the computer with the processing system.

Explanation:

..............................................................

6 0
2 years ago
A piece of glass has a thin film of gasoline floating on it. A beam of light is shining perpendicular on the film. If the wavele
kobusy [5.1K]

Answer:

200 nm

Explanation:

We need a constructive interference to see the bright reflection

we know that 2t=m\lambda  where m=1 and \lambda is the wavelength of the gasoline

so \lambda =\frac{560}{1.4}=400nm

putting the value of m and \lambda in thickness equation

t=\frac{1\times 400}{2}=200nm

so the thickness of the film will be 200 nm

3 0
3 years ago
What is the primary responsibility of the physical layer in data communication?
melamori03 [73]
 It is responsible for transmitting these bits as signals over a wire, optical fiber, wireless, or other <span>medium.</span>
3 0
3 years ago
What are strategies that you can use to yield web sites that are relevant to your research topic?
evablogger [386]

Answer: PLEASE MARK BRAINELEIST

Locating Useful Resources

When you chose a paper topic and determined your research questions, you conducted preliminary research to stimulate your thinking. Your research proposal included some general ideas for how to go about your research—for instance, interviewing an expert in the field or analyzing the content of popular magazines. You may even have identified a few potential sources. Now it is time to conduct a more focused, systematic search for informative primary and secondary sources.

5 0
3 years ago
Other questions:
  • _____ refer(s) to computer programs that provide instructions for a computer to execute a desired task. Answer .a.Software .b. I
    7·1 answer
  • When should you use the Reply All function when replying to an email
    10·2 answers
  • If Johanna wants to label the x- and y-axes in Excel she should click Layout, then what?
    12·1 answer
  • A program is considered portable if it . . . can be rewritten in a different programming language without losing its meaning. ca
    13·1 answer
  • Please help me with this question. I don’t get it
    11·2 answers
  • To access your gradebook you click on the __________.
    6·2 answers
  • Charlie does not think he will be able to finish his project by the deadline at this point in the decision making progress to so
    13·1 answer
  • Which of the following extends a network over a large geographic area by connecting local area networks together?
    14·2 answers
  • Who is responsible for the actions of autonomous systems? (please help me :C)
    14·2 answers
  • What is the name for data generated by a computer using an algorithm?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!