Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created March 28, 2014 15:21
Show Gist options
  • Save pepet96/9835297 to your computer and use it in GitHub Desktop.
Save pepet96/9835297 to your computer and use it in GitHub Desktop.
public class Mummy{
double heightes;
double widthes;
int ages;
String names;
public Mummy(){
}
public double getHeight(){
return heightes;
}
public void setHeight(double height){
heightes = height;
}
public double getWidth(){
return widthes;
}
public void setWidth(double weight){
widthes = weight;
}
public int getAge(){
return ages;
}
public void setAge(int age){
ages = age;
}
public String getName(){
return names;
}
public void setName(String name){
names = name;
}
public int ageConverter(){
return ages * 365;
}
}
import java.util.Scanner;
public class mummyTest{
public static void main(String [] args){
Scanner input = new Scanner(System.in);
Mummy mummy1 = new Mummy();
Mummy mummy2 = new Mummy();
Mummy mummy3 = new Mummy();
double height1, height2, height3, width1, width2, width3;
String name1, name2, name3;
int age1, age2, age3;
System.out.println("Please type the name of each mummy:");
name1 = input.next();
mummy1.setName(name1);
name2 = input.next();
mummy2.setName(name2);
name3 = input.next();
mummy3.setName(name3);
System.out.println("Please type in the height of each mummy:");
height1 = input.nextDouble();
mummy1.setHeight(height1);
height2 = input.nextDouble();
mummy2.setHeight(height2);
height3 = input.nextDouble();
mummy3.setHeight(height3);
System.out.println("Please type the width of each mummy:");
width1 = input.nextDouble();
mummy1.setWidth(width1);
width2 = input.nextDouble();
mummy2.setWidth(width2);
width3 = input.nextDouble();
mummy3.setWidth(width3);
System.out.println("Please input the age of each mummy:");
age1 = input.nextInt();
mummy1.setAge(age1);
age2 = input.nextInt();
mummy2.setAge(age2);
age3 = input.nextInt();
mummy3.setAge(age3);
System.out.println("Mummy " + mummy1.getName() + " is " + mummy1.ageConverter() + " days old.");
System.out.println("Mummy " + mummy2.getName() + " is " + mummy2.ageConverter() + " days old.");
System.out.println("Mummy " + mummy3.getName() + " is " + mummy3.ageConverter() + " days old.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment