Home Answers Viewqa Java-Beginners scanner problem

 
 


kagina
scanner problem
1 Answer(s)      4 years and a month ago
Posted in : Java Beginners

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 Pages:
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 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
Pattern,Matcher,Formatter and Scanner classes
Pattern,Matcher,Formatter and Scanner classes This section Describes : 1... using the Formatter and Scanner classes and the PrintWriter.format/printf...; java.lang.Error: Unresolved compilation problem: Invalid escape sequence (valid
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
without scanner
and class and didn't use the scanner .   Hi Friend, Whether
scanner - Java Beginners
scanner   how to ask user to enter index in arry using scanner
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
connectivity problem
[]args) { try{ Scanner s=new Scanner(System.in
JAVA Problem
) { Scanner input=new Scanner(System.in); System.out.print("Enter word
XII STD RECURSION WITHOUT SCANNER
not wish to use the scanner class Is there anything i can do to improve
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
barcode scanner device usage in database application
barcode scanner device usage in database application  Am trying to design a supermarket inventory desktop database application however I can't seem to know how to use a barcode scanner device on my application can anyone put me
Array /string based problem....
Array /string based problem....  thanx to help me.but again a problem... solve this problem also as soon as possible..... import java.util.*; public class... Exception{ Scanner input=new Scanner(System.in); System.out.println("Enter number
string array based problem
sorted value: 11 12 13 3 this is the problem here...... import java.util.*; public... Exception{ Scanner input=new Scanner(System.in); System.out.println("Enter
code problem - Java Beginners
import java.util.*; public class Q2_sheet11 { static Scanner console=new Scanner(System.in); public static void main(String[]args) { char ch; String s
with out using scanner mul two matrices
with out using scanner mul two matrices  write a java program to multiply two matrices and print there result. note: don't use the scanner and the values is passed at run time....   import java.io.*; class
array and string based problem
main(String a[]){ Scanner input=new Scanner(System.in); int array[]=new
array and string based problem
main(String a[]){ Scanner input=new Scanner(System.in); int array[]=new
array and string based problem
main(String a[]){ Scanner input=new Scanner(System.in); int array[]=new
loop problem - Java Magazine
loop problem  import java.util.Scanner; class mychoice{ public static void main(String[] args){ Scanner choice = new Scanner(System.in...(new Student(4, "D")); Scanner scan = new Scanner(System.in); int menu = 0
java problem - Java Beginners
(bits) ; } } public static void main(String args[]){ Scanner input=new Scanner(System.in); System.out.print("Enter Number: "); int bi = input.nextInt
DiceRolls excersise problem
class DiceRolls { public static void main(String[] args) { Scanner input = new Scanner(System.in); int numRolls; int numDice; int
DiceRolls excersise problem
class DiceRolls { public static void main(String[] args) { Scanner input = new Scanner(System.in); int numRolls; int numDice; int
Java code problem
); Scanner s=new Scanner(System.in); int ctr=0; do { System.out.println
java problem - Java Beginners
) throws Exception { int i=0; int min=10, max=99; Scanner scan = new Scanner
input using scanner and add/sub/mul/div of a matrix
input using scanner and add/sub/mul/div of a matrix  hiiii...... performe matrix add/sub/mul/div using scanner
Java Methods Problem - Java Beginners
specialPie; } public static void main (String[]args) { Scanner reader= new Scanner (System.in); String kind; int num; Pie applePie; Pie thePie
Java Methods Problem - Java Beginners
specialPie; } public static void main (String[]args) { Scanner reader= new Scanner (System.in); String kind; int num; Pie applePie; Pie thePie
Summary - Scanner
Java: Summary - Scanner The main use of java.util.Scanner is to read values from System.in or a file. Many Scanner methods fit a simple pattern: nextXYZ..., but Scanner also supports BigDecimal, BigInteger, Float (returns float), Boolean (returns
Creating a File I/O using import scanner, io.* and text.*
Creating a File I/O using import scanner, io.* and text.*  open a file for reading and open another file for writing data. input file hours-int, hourly rate-double, name-string. output file name-string, hours-int, hourly rate
Help with cypher and key problem in Java - Java Beginners
Help with cypher and key problem in Java  So far I have a program that asks a user for a message and a key amount and displays an encrypted message...) { String message; int key; Scanner reader = new Scanner(System.in); //standard
Sub combo box problem - Development process
Sub combo box problem  Hi, In this code Sub-Combo box is not working. plz solve the problem Search Page var arr = new...","Scanner","QC"); arr["Others"] = new Array("Mercedes","Toyoto","Maruti","Innovo
population problem plz help me befor 16 March 2011 !!
population problem plz help me befor 16 March 2011 !!  the Q is : How... population :" ); Scanner keyboard = new Scanner (System.in); popu = keyboard.nextInt... :"); Scanner keyboard = new Scanner(System.in); popu = keyboard.nextInt
can we use scanner class,class , object and methods to get output without using constructor ????
can we use scanner class,class , object and methods to get output without using constructor ????  im getting error here..i hav used scanner class... am i getting error here... can we get output using scanner class , object
i have a problem to do this question...pls help me..
i have a problem to do this question...pls help me..  Write a program that prompts the user to input an integer and the output the number...) { Scanner input = new Scanner(System.in); System.out.print
Console Input: Scanner
Java NotesConsole Input: Scanner The java.util.Scanner class (added... eventually have a GUI user interface, but Scanner is very useful for reading data... the name. Scanner in = new Scanner(System.in); //... Prompt
Eclipse (Problem with combining 2 codes together) - Java Beginners
Eclipse (Problem with combining 2 codes together)  hi, I have 2... Number (Between 1 to 3): "); Scanner scan = new Scanner(System.in); userInput... userInput = 0; System.out.print("Enter Movie Time That You Prefer: "); Scanner
Local Port Scanner
Local Port Scanner       This is a simple program of java network. Here, we are going to define class named "LocalPortScanner" in which we use ServerSocket class
Low port Scanner
Low port Scanner       In this section, you will learn how to get local port number of the local machine. Here, we define the name of program LowPortScanner
Eclipse (Problem with combining 2 codes together)(Cont) - Java Beginners
Eclipse (Problem with combining 2 codes together)(Cont)  Hi, I have a problem with this code (below), I enter the username and password correctly... class Main { static Scanner scan = new Scanner(System.in); public static
Please give me the code for the below problem - Java Interview Questions
Please give me the code for the below problem  PROBLEM : SALES TAXES Basic sales tax is applicable at a rate of 10% on all goods, except books...(); Scanner input = new Scanner(System.in); ArrayList list
How to read from the console
Description: Scanner was introduced in jdk 1.5. This class help in taking the input from the console. Here in this sample program it will take one word...;sc = new Scanner(cons.reader());     

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.