Created
April 1, 2014 06:03
-
-
Save JorgeOlvera/9908547 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class mummy{ | |
double height, width; | |
int age; | |
String name; | |
public Mummy(){ | |
} | |
public double getHeight(){ | |
return height; | |
} | |
public void setHeight(double mHeight){ | |
height = mHeight; | |
} | |
public double getWidth(){ | |
return width; | |
} | |
public void setWidth(double mWidth){ | |
width = mWidth; | |
} | |
public int getAge(){ | |
return age; | |
} | |
public void setAge(int mummyAge){ | |
age = mummyAge; | |
} | |
public String getName(){ | |
return name; | |
} | |
public void setName(String mummyName){ | |
name = mummyName; | |
} | |
public int yearToDay(int mummyAge){ | |
return mummyAge * 365; | |
} | |
} | |
import java.util.Scanner; | |
public class MummyApp{ | |
public static void main(String[] args) { | |
Scanner inputA = new Scanner(System.in); | |
Scanner inputB = new Scanner(System.in); | |
Scanner inputC = new Scanner(System.in); | |
Mummy m1 = new Mummy(); | |
Mummy m2 = new Mummy(); | |
Mummy m3 = new Mummy(); | |
String name1, name2, name3; | |
int age1, age2, age3; | |
System.out.println("Introduce the name of the first Mummy:"); | |
name1 = input.nextLine(); | |
m1.setName(name1); | |
System.out.println("Introduce the years of the first Mummy"); | |
age1 = input.nextInt(); | |
m1.setAge(age1); | |
System.out.println("Introduce the name of the second Mummy:"); | |
name2 = input2.nextLine(); | |
m2.setName(name2); | |
System.out.println("Introduce the years of the second Mummy"); | |
age2 = input2.nextInt(); | |
m2.setAge(age2); | |
System.out.println("Introduce the name of the third Mummy:"); | |
name3 = input3.nextLine(); | |
m3.setName(name3); | |
System.out.println("Introduce the years of the third Mummy"); | |
age3 = input3.nextInt(); | |
m3.setAge(age3); | |
System.out.println(m1.getName() + ", the mummy, is " + m1.yearToDay(age1) + " days old"); | |
System.out.println(m2.getName() + ", the mummy, is " + m2.yearToDay(age2) + " days old"); | |
System.out.println(m3.getName() + ", the mummy, is " + m3.yearToDay(age3) + " days old"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment