scanner problem

scanner problem

View Answers

April 29, 2009 at 10:04 AM

Hi Friend,

We are providing you a code that will calculate the area of triangle having base and height.

import java.util.*;

public class AreaOfTriangle
{
public static void main(String []args){
Scanner scanner = new Scanner(System.in);

System.out.print("Enter base (in cm): ");
double b = scanner.nextDouble();

System.out.print("Enter height (in cm): ");
double h = scanner.nextDouble();

double area=b*h*1/2;
System.out.println("Area of Triangle =" +area);
}
}
Thanks









Related Tutorials/Questions & Answers:
scanner problem - Java Beginners
scanner problem  the program that enters sides of the triangle using scanner and outputs the area of triangle  Hi Friend, We... main(String []args){ Scanner scanner = new Scanner(System.in
Scanner
Scanner   Hi, I am facing a problem in the following code as what should be the while condition I should use in order to get the loop keep running...= "Celsius"; do { Scanner temp_ip= new Scanner(System.in
Advertisements
Scanner class
Scanner class  what have to do when an error occur about Scanner class.i code scanner sc=new Scanner(System.in); but it shows an error regarding this.   Use Scanner sc=new Scanner(System.in
Scanner class
Scanner class  import java.util.*; class Dd { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int... Scanner class was introduced in java 5
scanner program
scanner program  a news paper boy purchase 100 papers every day.he purchases papers at Rs.1.50 and sells at Rs.2.00 at each.any unsold news papers... his profit..using scanner
Scanner
without scanner
and class and didn't use the scanner .   Hi Friend,ADS_TO_REPLACE_1
scanner Class Error - Java Beginners
scanner Class Error  Hello Sir ,When i run the program of Scanner Class ,there is Error Can not Resolve Symbol-Scanner how i can solve this problem,   Hi Friend, If your Java is not version 1.5 or above
scanner - Java Beginners
scanner   how to ask user to enter index in arry using scanner
ModuleNotFoundError: No module named 'scanner'
ModuleNotFoundError: No module named 'scanner'  Hi, My Python... 'scanner' How to remove the ModuleNotFoundError: No module named 'scanner... to install padas library. You can install scanner python with following command
ModuleNotFoundError: No module named 'scanner'
ModuleNotFoundError: No module named 'scanner'  Hi, My Python... 'scanner' How to remove the ModuleNotFoundError: No module named 'scanner... to install padas library. You can install scanner python with following command
Hp scanner - Java Beginners
Hp scanner  Hi guys, i would like to access hp scanner using java programme. could you refer me some useful information to proceed
cannot find symbol Scanner sc = new Scanner(system.in)
cannot find symbol Scanner sc = new Scanner(system.in)  In my one of the program in getting the error: cannot find symbol Scanner sc = new Scanner(system.in) How to resolve the error: cannot find symbol Scanner sc = new Scanner
Scanner vs. BufferedReader
Scanner vs. BufferedReader  I have to decide from these two classes to read a file. File is of .txt type and its size is around 4.5 GB. There other text files also which is around 7 to 10 GB. So, which class is to be used to read
ModuleNotFoundError: No module named 'collection-scanner'
ModuleNotFoundError: No module named 'collection-scanner'  Hi, My... named 'collection-scanner' How to remove the ModuleNotFoundError: No module named 'collection-scanner' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'collection-scanner'
ModuleNotFoundError: No module named 'collection-scanner'  Hi, My... named 'collection-scanner' How to remove the ModuleNotFoundError: No module named 'collection-scanner' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'collection-scanner'
ModuleNotFoundError: No module named 'collection-scanner'  Hi, My... named 'collection-scanner' How to remove the ModuleNotFoundError: No module named 'collection-scanner' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'gram-scanner'
ModuleNotFoundError: No module named 'gram-scanner'  Hi, My Python... 'gram-scanner' How to remove the ModuleNotFoundError: No module named 'gram-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jshint-scanner'
ModuleNotFoundError: No module named 'jshint-scanner'  Hi, My... named 'jshint-scanner' How to remove the ModuleNotFoundError: No module named 'jshint-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'netbox-scanner'
ModuleNotFoundError: No module named 'netbox-scanner'  Hi, My... named 'netbox-scanner' How to remove the ModuleNotFoundError: No module named 'netbox-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'port-scanner'
ModuleNotFoundError: No module named 'port-scanner'  Hi, My Python... 'port-scanner' How to remove the ModuleNotFoundError: No module named 'port-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'raccoon-scanner'
ModuleNotFoundError: No module named 'raccoon-scanner'  Hi, My... named 'raccoon-scanner' How to remove the ModuleNotFoundError: No module named 'raccoon-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'robots-scanner'
ModuleNotFoundError: No module named 'robots-scanner'  Hi, My... named 'robots-scanner' How to remove the ModuleNotFoundError: No module named 'robots-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'rtlsdr_scanner'
ModuleNotFoundError: No module named 'rtlsdr_scanner'  Hi, My... named 'rtlsdr_scanner' How to remove the ModuleNotFoundError: No module named 'rtlsdr_scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ssh_scanner'
ModuleNotFoundError: No module named 'ssh_scanner'  Hi, My Python... 'ssh_scanner' How to remove the ModuleNotFoundError: No module named 'ssh_scanner' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'ssid-scanner'
ModuleNotFoundError: No module named 'ssid-scanner'  Hi, My Python... 'ssid-scanner' How to remove the ModuleNotFoundError: No module named 'ssid-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ssl-scanner'
ModuleNotFoundError: No module named 'ssl-scanner'  Hi, My Python... 'ssl-scanner' How to remove the ModuleNotFoundError: No module named 'ssl-scanner' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'string-scanner'
ModuleNotFoundError: No module named 'string-scanner'  Hi, My... named 'string-scanner' How to remove the ModuleNotFoundError: No module named 'string-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'tarfile_scanner'
ModuleNotFoundError: No module named 'tarfile_scanner'  Hi, My... named 'tarfile_scanner' How to remove the ModuleNotFoundError: No module named 'tarfile_scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'tarfile_scanner'
ModuleNotFoundError: No module named 'tarfile_scanner'  Hi, My... named 'tarfile_scanner' How to remove the ModuleNotFoundError: No module named 'tarfile_scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'virtual-scanner'
ModuleNotFoundError: No module named 'virtual-scanner'  Hi, My... named 'virtual-scanner' How to remove the ModuleNotFoundError: No module named 'virtual-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'waveplot-scanner'
ModuleNotFoundError: No module named 'waveplot-scanner'  Hi, My... named 'waveplot-scanner' How to remove the ModuleNotFoundError: No module named 'waveplot-scanner' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'yara-scanner'
ModuleNotFoundError: No module named 'yara-scanner'  Hi, My Python... 'yara-scanner' How to remove the ModuleNotFoundError: No module named 'yara-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'zebra-scanner'
ModuleNotFoundError: No module named 'zebra-scanner'  Hi, My... 'zebra-scanner' How to remove the ModuleNotFoundError: No module named 'zebra-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'barcode-scanner'
ModuleNotFoundError: No module named 'barcode-scanner'  Hi, My... named 'barcode-scanner' How to remove the ModuleNotFoundError: No module named 'barcode-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cloud-scanner'
ModuleNotFoundError: No module named 'cloud-scanner'  Hi, My... 'cloud-scanner' How to remove the ModuleNotFoundError: No module named 'cloud-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'collection-scanner'
ModuleNotFoundError: No module named 'collection-scanner'  Hi, My... named 'collection-scanner' How to remove the ModuleNotFoundError: No module named 'collection-scanner' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'gram-scanner'
ModuleNotFoundError: No module named 'gram-scanner'  Hi, My Python... 'gram-scanner' How to remove the ModuleNotFoundError: No module named 'gram-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jshint-scanner'
ModuleNotFoundError: No module named 'jshint-scanner'  Hi, My... named 'jshint-scanner' How to remove the ModuleNotFoundError: No module named 'jshint-scanner' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'kafka-scanner'
ModuleNotFoundError: No module named 'kafka-scanner'  Hi, My... 'kafka-scanner' How to remove the ModuleNotFoundError: No module named 'kafka-scanner' error? Thanks   Hi, In your python
Version of com.metapossum>metapossum-scanner dependency
List of Version of com.metapossum>metapossum-scanner dependency
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
problem in validation
problem in validation  sir/madam, i m using struts-1.3.10. i m getting a problem my properties file is not found.... while i hav configuired it in struts-config.xml file, likeADS_TO_REPLACE_1 thanks n regards himanshu
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Problem with loginbean.jsp
Problem with loginbean.jsp  http://www.roseindia.net/jsp/loginbean.shtml - I am getting an error in loginbean.jsp.There is some error regarding .What is hello in this? Also in this example how
connectivity problem
[]args) { try{ Scanner s=new Scanner(System.in
Java file scanner
Java file scanner In this section, you will learn how to read a file using Scanner class. Description of code: J2SE5.0 provides some additional classes.... It also parses the primitive data. Scanner class gives a great deal of power
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set

Ads