Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LutenicaJar {
- double pepperPercentage;
- double tomatoPercentage;
- double jarCapacity;
- double salt;
- double season;
- boolean transparentJar;
- boolean haveCarrot;
- boolean isDone;
- public LutenicaJar(){
- this.pepperPercentage = 0;
- this.tomatoPercentage = 0;
- this.jarCapacity = 200;
- this.salt = 0;
- this.season = 0;
- this.transparentJar = true;
- this.isDone = false;
- this.haveCarrot = false;
- System.out.println("I like your idea to create some Lutenica! :)");
- }
- void cooking(){
- isDone = true;
- System.out.println("You just cooked your Lutenica!!!");
- }
- void addingPepper(double pepper){
- this.pepperPercentage = (pepper/this.jarCapacity) * 100;
- System.out.println("Isn't that too much peppers?");
- }
- void addingTomato(double tomato){
- this.tomatoPercentage = (tomato/this.jarCapacity) * 100;
- System.out.println("That's a nice amount of Tomatoes!");
- }
- void addingSalt(double moreSalt){
- this.salt += moreSalt;
- System.out.println("It wasn't salty enough, righht?");
- }
- void info(){
- System.out.println();
- System.out.println(("In your jar you have"+ String.format("%.2f", this.pepperPercentage) + "% of pepper and "+ String.format("%.2f", this.tomatoPercentage)+ "% of tomatoes."));
- if (this.salt >= this.jarCapacity/20) {
- System.out.println(String.format("You have %.1fg of salt. That's too much for your Lutenica!", this.salt));
- }
- else{
- System.out.println(String.format("You have %.1fg of salt. That much is good for your Lutenica!", this.salt));
- }
- if (this.transparentJar){
- System.out.println("Congratulations! You can see your Lutenica through the jar!");
- }
- else{
- System.out.println("Don't worry. You can always open it and see it from the top! :)");
- }
- if (this.haveCarrot){
- System.out.println("Nice decision to put some carrot! ;)");
- }
- else{
- System.out.println("You don't have carrot. Everybody has a different taste!");
- }
- if (this.isDone){
- System.out.println("You have ready-to-eat Lutenica. :)");
- }
- else{
- System.out.println("You have to cook that beauty.");
- }
- System.out.printf("Your lutenica is from season %s", this.season);
- if (this.season < 2018){
- System.out.print("It's a bit old but I hope it's still delicious.");
- }
- else{
- System.out.print("It's fresh. Go for it!!!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement