Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Eingabe extends Taschenrechner3 {
- double a;
- double b;
- int operation;
- private Scanner scin = new Scanner(System.in);
- public Eingabe(){
- this.a= this.getInput("bitte geben sie die erste zahl ein");
- this.b= this.getInput("bitte geben sie die zweite zahl ein");
- this.operation = (int) this.getInput("bitte geben sie eine oppertation ein\n (1= addieren 2=subtraieren \n3=multi 4= div 5=prozent)");}
- public double getInput(String string)
- {
- System.out.println(string);
- return Double.parseDouble(scin.next());
- }
- public void rechnung(){
- if ( operation==1){
- addition( a, b);
- System.out.println(super.addition( a, b));
- }
- else if (operation==2){
- subtraktion(a, b);
- }
- else if (operation==3){
- multiplikation(a, b);
- }
- else if (operation==4 ){
- division(a, b);
- }
- else if (operation == 5){
- prozent(a, b);
- }
- else if (operation== 6){
- potenz(a, b);
- }
- else if (a > 6){
- System.out.println("Ihre Eingabe ist ungültig");
- }
- }
- public static void main(String[]args){
- new Eingabe();
- new Taschenrechner3();
- new Alientaschenrechner();
- }
- }
Add Comment
Please, Sign In to add comment