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
2 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]2 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
What are some options available when inserting an address block? Check all that apply. previewing postal code full address label
iVinArrow [24]

Answer:

A. previewing

B. postal code

C. full address

E. matching fields

F. company name

7 0
3 years ago
Read 2 more answers
2 steps to electronically reproduce an image
yawa3891 [41]

Answer:

The two steps are: obtaining rights to reproduce the photograph from the copyright owner. The owner can be a photographer, some company or stock house dealing photos. And the requester has to get the rights for all that is in the picture like a celebrity, trademark rights, etc. However, if you sign the enclosed document then you need to take care of the first step only.

Explanation:

Please check the answer.

5 0
2 years ago
A constructor ____ overloaded.
Lesechka [4]

Answer:

I'm sure the answer is A

Explanation:

It could not be B because it never not overloaded

7 0
2 years ago
PLEASE HELP!!!!!! I NEED THIS NOW!!!!!!!
Sonbull [250]

Answer: I believe it is a web server.

Explanation:

6 0
3 years ago
Read 2 more answers
The Dash Cell Phone Company charges customers a basic rate of $5 per month to
Ne4ueva [31]

Answer:

Pseudocode is explained below for all cases

Explanation:

* Read Customer_area with robust input for a positive integer with three digits

* Read Customer_phone with robust input a positive integer with seven digits

* Read Customer_text with robust input for positive integers

* print "Basic rate for subscription: $5 per month", set Customer_bill to 5

* select case of

: Customer_text <= 60 print "No extra charge for text messages"

: Customer_text <= 180 print "(Customer_text - 60) * 0.05 extra for text messages", add (Customer_text - 60) * 0.05 to Customer_bill

: Customer_text > 180 print "$6 extra for text messages from 60 - 180, (Customer_text - 180) * 0.10 extra for text messages beyond 180", add (Customer_text - 180) * 0.10 to Customer_bill, add 6 to Customer bill

* print "Bill before taxes is Customer_bill"

* Customer_finalbill = Customer_bill * 1.12

* print "Bill after 12% federal, state and local tax is Customer_finalbill"

4 0
2 years ago
Other questions:
  • Business Risks are ​
    15·1 answer
  • if you want to present slides to fellow students and co-workers which productivity software should you use to create them?
    13·1 answer
  • What is the name of the option in most presentation applications with which you can modify slide elements?
    14·1 answer
  • In Alphatech Systems, email software screens incoming messages by organizing them into mailboxes and identifying junk mail. As a
    13·1 answer
  • What tasks do most operating systems perform?
    7·2 answers
  • Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up
    14·1 answer
  • Which keys can be pressed to change the cuboid/frame selector color on remotasks lidar course
    6·1 answer
  • If you want to share information with individuals who are internal to your organization, which type of network would you want to
    6·1 answer
  • While working in a group of two the members are not getting along. You bring the two members together so they can discuss this i
    11·1 answer
  • Which of the following best describes a hotspot as
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!