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
Name and describe the two (2) broad categories of files
fenix001 [56]
If it’s computer files, that would be System Software and Application software.

“The System Software is the programs that allow the computer to function and access the functionality of the hardware. Systems software sole function is the control of the operation of the computer.

Applications software is the term used for programs that enable the user to achieve specific tasks such as create a document, use a database or produce a spreadsheet.”
8 0
3 years ago
How to turn off location on iphone without person knowing
andrezito [222]

Answer:

airplane mode

Explanation:

5 0
3 years ago
A marketing firm has been hired to help a client understand how their online brand is perceived. The firm has set up a system to
KiRa [710]

Answer:

Automated Reasoning

Explanation:

Automated reasoning is a type of Natural language understanding(NLP) in computer science that makes logical inferences based on information or data previously gathered. Automated reasoning allows computers make intelligent decisions and reason logically based on data gathered. For example, a system is based to scan online reviews and conclude on the ones that are negative reactions based on previous data.

3 0
3 years ago
Which of the following is an example of an open-ended question?
Tpy6a [65]

Answer:

<em>What are your thoughts about this?</em>

Explanation:

A question that can be answered with yes or no is a closed question.

4 0
3 years ago
How do you make the task bar and e-mail read in larger print
JulijaS [17]
You have to go into settings and search larger text
5 0
3 years ago
Other questions:
  • If you work up to your potential but fall short of your goals, you
    15·2 answers
  • What component of a computer system holds the operating system when the computer is not running
    6·2 answers
  • What kind of website uses keywords to locate content?
    15·1 answer
  • Wich technology can a website use to allow you to listen to a concert live over the internet?
    10·1 answer
  • The idea that innovations in transportation and communication technologies has changed the way we think about distance and time
    9·1 answer
  • If I could make a Short Film on any topic it would be...how could that film change the world?
    9·1 answer
  • Which of the following is a characteristic of vector graphics?
    15·2 answers
  • What is the answer ????​
    13·2 answers
  • This unintelligent brain of mine decided to charge my phone overnight thinking that nothing bad will happen ;-; the next morning
    11·1 answer
  • 3.8 LAB: Read values into a list
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!