Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete object class called CoffeeMaker. Your class should have the fol

ID: 3776933 • Letter: W

Question

Write a complete object class called CoffeeMaker. Your class should have the following: Three data fields, an integer for the number of scoops of coffee in the maker, a double to keep track of the number of cups of water in the maker and a boolean to show whether the coffee maker is off or on. A zero-argument constructor that sets up a coffee maker with no water, no coffee and turned off. An argumented constructor that creates a coffee maker with a specified amount of water and coffee but turned off. Accessors for each one of the data fields. Mutators to accomplish the following Add water and coffee to the coffee maker (single method) Clean the coffee maker - remove the water, remove the coffee and turn the coffee maker off Make coffee - if there is no coffee or water, return the String "can't make coffee right now". If there is water and coffee present, turn the coffee maker to on and return the strength of the coffee depending on the ratio of cups water to scoops of coffee: if cups to scoops 1 return the String "weak coffee", else return the String "good coffee". An appropriate toString() method.

Explanation / Answer

package com.coffeeMaker;

public class CoffeeMaker {
   Integer scoops;
   Double waterCups;
   Boolean coffeMakerStatus;
  
   public CoffeeMaker(){
       this.scoops=0;
       this.waterCups=0.0;
       this.coffeMakerStatus=false;
   }
   public CoffeeMaker(int scoops,double waterCups){
       this.scoops=scoops;
       this.waterCups=waterCups;
       this.coffeMakerStatus=false;
   }
  
   public void cleanCoffeeMaker(){
       this.scoops=0;
       this.waterCups=0.0;
       this.coffeMakerStatus=false;
       System.out.println("Coffee maker is clean now");
   }
  
   public void makeOneCupCoffee(){
       this.scoops=1;
       this.waterCups=0.5;
       this.coffeMakerStatus=true;
       System.out.println("One cup of coffee is ready");
   }
  
   public void makeCoffee(int scoops,double waterCups){
       this.scoops=scoops;
       this.waterCups=waterCups;
       this.coffeMakerStatus=true;
       System.out.println("coffee is ready");
   }

   public static void main(String[] args) {
       CoffeeMaker coffeeMaker=new CoffeeMaker();
       coffeeMaker.makeOneCupCoffee();
       coffeeMaker.cleanCoffeeMaker();

   }

   public Integer getScoops() {
       return scoops;
   }

   public void setScoops(Integer scoops) {
       this.scoops = scoops;
   }

   public Double getWaterCups() {
       return waterCups;
   }

   public void setWaterCups(Double waterCups) {
       this.waterCups = waterCups;
   }

   public Boolean getCoffeMakerStatus() {
       return coffeMakerStatus;
   }

   public void setCoffeMakerStatus(Boolean coffeMakerStatus) {
       this.coffeMakerStatus = coffeMakerStatus;
   }
  
  

}

//output

One cup of coffee is ready
Coffee maker is clean now

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote