title: Handle Constructor in Calculating the Summation using java
body: <p>I want to make a Calculation of insurance sum with Household insurance. The initial requirements are: 2 insurance products with different price per m²
  1. Compact: 650 € per m²
  2. Optimal: 700 € per m²
  the 2 input of this program are:"Compact" or "Optimal"
  and Living space in m².
  And the output should be Insurance sum;
  It is mandatory to note down that this program may be extended by other products with complicated calculations.</p>
  
  <p>I am proceeding in this way, but as I am new in java, I am stuck in the situation how to handle the constructor. In my code I want to fix the compact and Optimal, but I want to get the value of Living space by user input, such as scanner class. How can I do this in this case.</p>
  
  <pre><code>My Insurance class 
  public class Insurance {
    private Double Kompakt;
    private Double Optimal;
  
    public Insurance(Double kompakt, Double optimal) {
  
      this.Kompakt = kompakt;
      this.Optimal = optimal;
  }
  
  public Double getKompakt() {
      return Kompakt;
  }
  
  public void setKompakt(Double kompakt) {
      this.Kompakt = kompakt;
  }
  
  public Double getOptimal() {
      return Optimal;
  }
  
  public void setOptimal(Double optimal) {
      this.Optimal = optimal;
   }
  }
  </code></pre>
  
  <p>My Sum Class is</p>
  
  <pre><code>public class Sum extends Insurance{
  
   private int livingSpace;
  
    public Summe(Double kompakt, Double optimal, int Wohnfläche) {
      super(1.0, 1.0);
      this.livingSpace=livingSpace;
      this.setCompakt(650.00); // I want to fix value of Compact
      this.setOptimal(700.00); // I want to fix Value of Optimal
      }
  
  
  public double CompaktSum(){
  
          double sum= getCompakt()*livingSpace;
          return sum;
      }
      public double OptimalSum(){
          double sum =getOptimal()*livingSpace;
          return sum;
      }
  }
  </code></pre>
  
  <p>Now in my main class I want to set value of livingSpace manually but I can not call the constructor without the setting method</p>
  
  <pre><code> public static void main(String[] args) {
      Scanner sc1 =new Scanner(System.in);
      Scanner sc2 =new Scanner(System.in);
      System.out.println("1\tCompact: 650 € per m²\n2\tOptimal: 700 € per 
      m²");
      System.out.println("Please choose your 1 for Compact and 2 for product");
      int swichValue=sc1.nextInt();
      Summe hs=new Summe(1.0,1.0,5); // I am having problem here, I just want 
      //to call empty contructor so that I can set livingSpace manually
  
      switch(swichValue){
      case 1:{
      double res=hs.KompaktSumme();
      System.out.println("Versicherungssumme ist : "+res);
      break;
      }
      case 2:{
          double res=hs.OptimalSumme();
          System.out.println("Versicherungssumme ist : "+res);
          break;
      }
      case 3:{
          System.out.println("Error");
  
      }
      }
  }
  </code></pre>