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
Brian gathers data from his classmates about the computers they own such as the type of operating system, the amount of memory,
Stells [14]

Incomplete question. The Options read;

A. The year purchased

B. Brian's classmates

C. The amount of memory

D. The type of operating system

Answer:

<u>B. Brian's classmates</u>

Explanation:

<em>Remember,</em> the question is concerned about <em>"the individuals"</em> in the data set, <u>so the year they purchased their computer, neither is the amount of memory of the computer and the type of operating system can be classified as individuals in the data set.</u>

Hence, we can correctly say, only Brian's classmates are the individuals in this data set.

4 0
2 years ago
Which OS function does a CLI fulfill? A User interface B Running applications C Hardware interface D Booting
konstantin123 [22]

Answer:

User Interface

Explanation:

4 0
3 years ago
You have repaired a broken LCD panel in a laptop computer. However, when you disabled the laptop, you bent the hinge on the lid
Alex787 [66]
Yes it would take a second or todo
8 0
3 years ago
You complete your database, and the company begins using it. Shortly afterwards, two GearUp buyers, Cora and Owen, work together
Olegator [25]

Answer: Multi-user issue

Explanation: A database management system scheme can have multi-user issue when the designing of the system is not made properly. The multi user issue rises when the users concurrently access the data from the database and related error get invoked due to some reason like  repeatable reading issue, serialization, etc.

The reading problem is usually can be related to reading of the database in  uncommitted manner, uncommitted reading, repeatedly reading etc.Thus, Cora and Owen are accessing the database concurrently which can create multi-user issue.

3 0
3 years ago
Which of the following statements is correct?
vaieri [72.5K]

Answer:

A

Explanation:

I think is A. or maybe search up the topic of the lesson

7 0
3 years ago
Other questions:
  • The producer thread will alternate between sleeping for a random period of time and inserting a random integer into the buffer.
    7·1 answer
  • It is important for a writter to include voice and point of view in writting because _______
    11·1 answer
  • Megan has written the following rough draft for her assignment. Choose the correct way to complete each sentence. Sarah is creat
    13·1 answer
  • The _____ function is a logical function that returns a TRUE value if any of the logical conditions are true and a FALSE value i
    10·1 answer
  • What can act as a buffer against unemployment
    11·1 answer
  • What is the device that uses sprockets along a film's perforated edges to run 50 feet of film in thirty seconds? A. cinematograp
    10·1 answer
  • The __________ utility has the capability to manage users, create and administer user groups, and apply user rights to those use
    8·1 answer
  • Users who are connecting to an NLB cluster have been complaining that after using the site for a few minutes they are prompted t
    15·1 answer
  • You are asked to write a program that prompts the user for the size of two integer arrays, user input for the size must not exce
    13·1 answer
  • When you use the predict step in the IPDE process you
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!