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
Can you structure this code in if-statements?
Naddika [18.5K]
Not sure what quizScore1-5 is, but here it is. Also, I'm not entirely sure what language you're working with here, but null can't be returned as an integer. If it were a string, for example, it'd be possible as string is an object reference type.

public int getData(int dataNumber)
{
    if (dataNumber == 1)
        return quizScore1;
    else if (dataNumber == 2)
        return quizScore2;
    else if (dataNumber == 3)
        return quizScore3;
    else if (dataNumber == 4)
        return quizScore4;
    else if (dataNumber == 5)
        return quizScore5;
    else
        return 0;
}
3 0
2 years ago
Choose the two main capabilities involved in visual literacy
andreyandreev [35.5K]

The two main capabilities involved in visual literacy are:

<span>1)   </span>Communication through use of visual elements.

<span>2)   </span>Interpret meaning from visual elements.

<span>Visual literacy is the capacity to decipher, arrange, and make significance from data displayed as a picture, broadening the importance of proficiency, which means understanding of a composed or printed content.</span>

7 0
3 years ago
A signal travels from point A to point B. At point A, the signal power is 100 W. At point B, the power is 90 W. What is the atte
11Alexandr11 [23.1K]

Answer:

Attenuation = 0.458\ db

Explanation:

Given

Power at point A = 100W

Power at point B = 90W

Required

Determine the attenuation in decibels

Attenuation is calculated using the following formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Where P_s = Power\ Input and P_d  = Power\ output

P_s = 100W

P_d = 90W

Substitute these values in the given formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Attenuation = 10Log_{10}\frac{100}{90}

Attenuation = 10 * 0.04575749056

Attenuation = 0.4575749056

Attenuation = 0.458\ db <em>(Approximated)</em>

7 0
3 years ago
Office ____ is the current version of Microsoft Office for Mac operating systems.
gregori [183]

The current version of office is "Office 19" most people use "Office 365" though.

A "Pdf" or "Portable Document Format."

4 0
3 years ago
Omar sends a PDF file to his teacher. He then prepares another copy of the presentation that includes only the slides he wants t
maria [59]

Answer:

D. Custom Slide Show

Explanation:

Correct on edg

7 0
3 years ago
Other questions:
  • A database on a mobile device containing bands, sub-bands and service provider IDs allowing the device to establish connection w
    9·1 answer
  • 1. Mobile devices have a _________ viewport that displays a web page content that fits within a mobile screen.
    11·1 answer
  • Jackson is teaching the decimal number system. He wants his students to know how to expand numbers by powers of 10. Which is the
    13·2 answers
  • To aid Android app developers, who must account for multiple screen sizes and resolutions, Android has introduced the ____, whic
    15·1 answer
  • Instagram
    9·1 answer
  • Which statistical function in a spreadsheet helps you to see how far each number varies, on average, from the average value of t
    5·1 answer
  • ou use productivity apps on your iPad tablet device while traveling between client sites. You're concerned that you may lose you
    11·1 answer
  • Compare and contrats the vain digestive system from the human digestive system.​
    10·1 answer
  • Suppose that a particular algorithm has time complexity T(n) = 3 \times 2^nT(n)=3×2 ​n ​​ and that executing an implementation o
    14·1 answer
  • Why do Linux administrators prefer to give sudo access to application teams instead of letting them su to root?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!