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
PLEASE HELP !!!!!! INTERNET SAFTEY
blondinia [14]
On the football field
4 0
4 years ago
Read 2 more answers
Which of the following is a major difference between XSS attacks and remote code exploits?
Dafna1 [17]

Answer:

Option (c) Remote code exploits aim to escalate attackers’ privileges, while XSS attacks aim to gain access only

Explanation:

  • XSS stands for Cross-site Scripting. In this types of attacks, a malicious code is injected in the trusted web sites and it sends the malicious code into the users. The users think that the genuine code was sent but not.
  • This involves sending server side scripts which are executed by the user and these may even change the html pages too.
  • Remote code exploitation means the user can inject the code and try to gain access. Usually, all the programming languages have evaluation functions if used the user can try to gain the access with this evaluation functions.
  • This can lead to the compromise of the whole web server too.So, it is not a good practice to use the evaluation functions by the developers.
  • In this type of attack, the attacker tries to inject the code remotely.
  • Option (c) is correct and options (a),(b) and (d) are wrong options.
4 0
3 years ago
Identify a stressor in your life. Conduct an internet search to locate at least two reliable sources of information on effective
Gre4nikov [31]

Answer:

The biggest stressor in my life is certainly accountancy. I need to divide my earning among my family members, however, I had to work as well. and hence, I wanted to cover this automatically. I decided to surf the internet. I realized I need to first find the keyword. And I found it as budgeting and the monthly income. I got all my answers. The source explained to be how I can transfer a part of my income to each of my family members, and also to grocery sites like Amazon, the daily service provider who provide various home servants, for electricity bills, yearly water tax, house tax, and all my expenses. And now I can relax and work, as with one click, I can now pay all my bills, as well as I can order for instant food deliveries, call plumbers, electricians, etc any time and everything I can think of. I have no headache now, and I can devote all of my hours to work. And that has also increased my income since I went automatic.

Explanation:

Thus, we need to first find the keyword, and then find the best site from the list that appears. And then we need to research through that site and find the solution.We can make use of the search engine commands as well.

4 0
4 years ago
What is a "telescreen"? How is it different from the televisions we know? Is it possible to make a television that could see and
mars1129 [50]

Answer:

  1. Telescreens are devices that operate as televisions, security cameras, and microphones.
  2. A television is an electronic communication medium that allows the transmission of real-time visual images, and often sound while a telescreen is a television and security camera-like device used to keep things or people under constant surveillance, thus eliminating the chance of secret conspiracies.
  3. It could be employed in secretly investigating criminals and terrorists.
  4. It could also play a major role in politics by investigating suspicious government officials and those that plan Ill towards a nation.
  5. It would definitely be a great idea to install one of such.

Explanation:

8 0
3 years ago
What is the output of this line of code
LenKa [72]

Answer:

D - hellogoodbye

Explanation:

since your merging two string together you will simply just get one string in total

5 0
3 years ago
Read 2 more answers
Other questions:
  • What is the most common programming language that's not python?
    15·2 answers
  • Which of the following statements is correct? A. The columns will be listed in the results in the same order they are stored in
    7·1 answer
  • What nomenclature, commands, procedures are used by the program to define capabilities in the following
    15·1 answer
  • In Java the ______________are not objects. All of the rest areobjects, or any ___________ is called as object.
    10·1 answer
  • The domain name service (dns is a distributed database that allows users to communicate with each other computers by:
    7·1 answer
  • Cookies Are Us runs a series of 100 cookie stores across the Midwestern United States and central Canada. At the end of each day
    13·1 answer
  • Explain the difference between good and bad table structures. How do you recognize the difference between good and bad structure
    14·1 answer
  • What tag is used to contain information about a web page, such as the title and related pages?
    12·1 answer
  • What is window system?<br>​
    14·2 answers
  • Why is a Quality assurance tester needed on a software development team?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!