Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 16:50

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



java - buffered reader - input streamreader - if bedingung mit double

Discussion on java - buffered reader - input streamreader - if bedingung mit double within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2012
Posts: 42
Received Thanks: 4
java - buffered reader - input streamreader - if bedingung mit double

Hey ho ;D

ich lerne gerade in der Schule bisschen Java (mit Java Editor) und habe leider nen Problem.. mein Lehrer önnte ich auch fragen, jedoch habe ich diesen bis nächsten donnerstag nicht..

ich will ein programm schreiben welches mir flächen berrechnet (bin noch ein anfänger..)

Joa, leider gibt es schon am Anfang nen Fehler, also irgentwas will halt ned..

Ich habs mal als Bild gespeichert, weil viele den Java editor vllt. nicht haben, bzw. ein virus test hoch zuladen ist mir dann doch zu blöd ;D

Zum Programm:
________________________

Als erstes importiere ich eben den Buffered- und input streamreader, damit ich zahlen einlesen kann (das wir es mit dem java.util.Scanner machen will unser Lehrer iwie ned..)

dann erstell ich paar werte mit double.. int oder string nimmt er auch ned an.

die variable nexxt kackt dann ab, zahl nimmt er auch nicht und mit string oder int habe ich das auch schon probiert.

Der fehler kommt bei der if bedingung.. was mach ich da falsch?



_________________________

wäre nett wenn ihr auf mich rücksicht nehmt xd ich hab noch keinen plan von java xD

lg
Shozianv2 is offline  
Old 10/11/2012, 22:06   #2
 
elite*gold: 0
Join Date: Nov 2005
Posts: 40
Received Thanks: 8
Hi,

probier die initalisierung mal so:
Code:
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
Zudem hat der BufferedReader meines wissens nach nicht die methode readDouble(). Verwender stattdessen readLine(), welche allerdings die eingabe als string zurückgibt. Diese kannst du aber glücklicherweise sehr einfach zu einem double parsen.

das könnte dann folgendermaßen aussehen:

Code:
double input = Double.parseDouble(in.readLine());
anschließend dann die if-Schleife, wie du es schon gemacht hast.

Btw. falsches Forum

Gruß
fatalaty is offline  
Old 10/12/2012, 19:40   #3
 
airsonic's Avatar
 
elite*gold: 2
Join Date: Jul 2011
Posts: 371
Received Thanks: 108
lerne in der Schule auch Java mit dem Java-Editor
aber für was brauchst du eine if-schleife?
airsonic is offline  
Reply


Similar Threads Similar Threads
[QUESTION] Java: input keystrokes to other program?
09/23/2012 - General Coding - 1 Replies
Hi, I was wondering if i program a GUI and everything in java so that i can make keys get repeated multiple times (to create a bot) which i can do so far, is there a way to input these keystrokes to another program (a game)? I am not asking how to program all the rest just if there is a way to input it? I hope someone can help me. I prefer english answers but i can read german too just not write it :p Thanks in advance
[Java Release with Source] Account Info Saver & Reader
09/13/2008 - CO2 Programming - 5 Replies
Okay, i've updated the Acount Info Saver to make the files un-readable unless you use this, or just right click and open with notepad xD. So, anyways, pretty simple, i just had it remove the .txt extension, and made this program to read the text file itself. How to use - Just type your login ID you used to save the file with, and it should read it :) Note to a Mod: You can delete my old thread of the Saver, or you can keep it so people can learn how to write text files in java, doesnt...



All times are GMT +1. The time now is 16:50.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.