Java
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Java

on

  • 873 views

 

Statistics

Views

Total Views
873
Views on SlideShare
873
Embed Views
0

Actions

Likes
0
Downloads
28
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Java Document Transcript

  • 1. Array Import java.io.*; public class status { public static void main(String argv[]) throws IOException { int i, anzahl, auswahl; String status[], str; BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); System.out.print(quot;Geben Sie die Anzahl der Stati ein: quot;); str=input.readLine(); anzahl=Integer.parseInt(str); status= new String[anzahl]; for(i=0;i<anzahl;i++) { System.out.print(quot;Geben Sie den Status ein: quot;); System.out.println(); status[i]=input.readLine(); } System.out.println(quot; Nr Statusquot;); for(i=0;i<anzahl;i++) { System.out.println(quot; quot;+(i+1)+quot; quot;+status[i]); } System.out.print(quot;Welchen Status wollen Sie sehen? quot;); str=input.readLine(); auswahl=Integer.parseInt(str); System.out.println(status[auswahl-1]); } }
  • 2. Klassen import java.io.*; public class Main { public static void main(String argv[]) { Quader quader1; quader1=new Quader(); quader1.breite=10; quader1.hoehe=20; quader1.laenge=30; quader1.showVolumen(); quader1.showOberflaeche(); } } public class Quader { //Attribute public int laenge; public int breite; public int hoehe; //Methoden public void showVolumen() { int volumen; volumen=breite*hoehe*laenge; System.out.println(quot; Das Volumen betraegt: quot;+ volumen + quot;m*m*mquot;); } public void showOberflaeche() { int oberflaeche; oberflaeche=2*(breite*laenge)+(breite*hoehe)+(laenge*hoehe); System.out.println(quot; Die Oberflaeche betraegt: quot;+ oberflaeche+ quot;m*m*mquot;); } }