Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners scanner problem
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


kagina
scanner problem
1 Answer(s)      5 years and 8 months ago
Posted in : Java Beginners



Advertisement
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
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
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
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
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
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
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
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
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
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
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
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
connectivity problem
[]args) { try{ Scanner s=new Scanner(System.in
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 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, like thanks n regards himanshu
JAVA Problem
) { Scanner input=new Scanner(System.in); System.out.print("Enter word
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
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 package
problem with package  Dear sir, i have created one java file with package com.net; and i compiled the program.it showing the .class file in " net" folder.The problem is i want to use that .class file in some other
Problem with cookies
Problem with cookies  Hello All, i need jsp code for RememberMe module of login. i am facing problem with cookies. so please if any one could guide me please help and provide mme the exact code.   Please visit
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
Advertisements
 

 

 

DMCA.com