I seem to really be lost. I have included the instructions for this problem, for you clarity only. I'm not asking you to do the work.I really want to learn java. I have read this complete chapter Three times now and seem to not be getting through my thick skull what I should add to this code from the second file (shown below).If you could show me the syntax for calling the setter/getters and how to implement the first if statement. I think i could finish the project.


A software company sells a package that retails for $99. Quantity discounts are given according to the following table:
Quantity Discount
10–19 20% 20–49 30% 50–99 40% 100 or more 50%
Design a class that stores the number of units sold and has a method that returns the total cost of the purchase.

import java.util.Scanner;

class SoftwareSales {
    
    public static void main(String[] args) {
   
    // Data Members
   String software, discount, or, more;
   double sales, product, units, number;
    
   
    Scanner keyboard = new Scanner(System.in);{
    
    
        System.out.print("Please enter the number of units sold.");
          keyboard.nextDouble();


import java.util.Scanner;

class SoftwareSales {
    
    public static void main(String[] args) {
   
    // Data Members
   String software, discount, or, more;
   double sales, product, units, number;
    sales = 99;
   
    Scanner keyboard = new Scanner(System.in);{
    
    
       System.out.print("Please enter the number of units sold.");
    keyboard.nextDouble();
    
    if (units < 10)
    (units * sales);
  else if (units > 9 && < 20)
(99 - (99 * 0.2));
  else if (units > 19 && < 50)
  (99 - (99 * 0.3));
  else if (units > 49 && < 100)
  (99 - (99 * 0.4))
  else if (units > 99)
      (99 -(99 * 0.5;)

     }

I'm missing something here and cant figure out what it is. Please Help!

Including class file:

import java.util.Scanner;
public class SoftwareSales {
    
    // Data Members
    private String software, discount, or, more;
    private double sales, product, units, number;
    
    //Constructor
    public SoftwareSales(String software, String discount, String or, String more, double sales, double product, double units, double number){
        sales = sales;
        product = product;
        units = units;
        number = number;
        software = software;
        discount = discount;
        or = or;
        more = more;
    }
    
    //Methods
    public double getSales() {
        return sales;
    }
    public double getProduct() {
        return product;
    }
    public double getUnits() {
        return units;
    }
    public double getNumber() {
        return number;
    }
    
    
    
    //Mutator Methods
    
    public void setSales (double sales) {
        sales = sales;
    }
    
    public void setProduct(double product) {
        product = product;
    }
    
    public void setUnits(double units) {
        units = units;
    }
    
    public void setNumber(double number) {
        number = number;
    }
}
Member Avatar for iamthwee

>.If you could show me the syntax for calling the setter/getters and how to implement the first if statement

Maybe you should have paid attention in class? Basic stuff really.

Firstly, I do not see anywhere in your main() method where you create a SoftWareSales object. You will need such an object to store the properties and call your methods on.

As far as using getter/setter

SoftwareSales someSoftware = new SoftwareSales( <all that constructor info here - I'm not going to type it all> );

// to get sales (using a getter)
double currentSales = someSoftware.getSales();

// to set number (using the setter)
double currentNumber = 75;
someSoftware.setNumber( currentNumber );

Thank you very much,Ezzara. l will leave a message for the smart one iamthwee maybe you should look for a different line of work. That is what I'm doing.I am 51 years old equipment operator that suffered a brain anuerisym and stroke, leaving me with partial use of my left hand and confined to a wheelchair(you know paralized)i I try not to share my condition with everyone, but people like you just bring out the best in me. By the way I'm ttrying to learn this online as a new way to support my family. Have a nice day you smart-ass!

commented: not smart -2

we've heard all the crybaby stories before, Curtis.

He was quite correct when he said that your question was incredibly basic. Any introductory tutorial would have given you the information had you cared to look.

What will you do next? Come here for every single thing you don't immediately understand? Post a hundred questions a day about every smallest detail?

And oh, don't go around calling people names. It doesn't make them at all more eager to help you in the future.
As it is you've already made yourself far less likely to ever get help again from some experienced people, not good if you're lookinng for advise.
But be glad we're not in the business (yet, it may yet come if you continue down the path you've chosen) of giving deliberately false advice in order to enjoy seeing you trash around in your self inflicted failure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.