Question

In: Computer Science

write a program in java that contain a class for botique . data member include code...

write a program in java that contain a class for botique . data member include code , color , size , quantity . your class should contains all accessor and mutator methods , non paraqmetric constructor , parametric constructor , input andvidsplay method

Solutions

Expert Solution

solution:

CODE:

public class Botique {
   private String code;
   private String color;
   private int size;
   private int quantity;
   public Botique() {
       // TODO Auto-generated constructor stub
       System.out.println("non prametrized contructor");
   }
  

   public Botique(String code, String color, int size, int quantity) {
       this();
      
       this.code = code;
       this.color = color;
       this.size = size;
       this.quantity = quantity;
   }


   public String getCode() {
       return code;
   }


   public void setCode(String code) {
       this.code = code;
   }


   public String getColor() {
       return color;
   }


   public void setColor(String color) {
       this.color = color;
   }


   public int getSize() {
       return size;
   }


   public void setSize(int size) {
       this.size = size;
   }


   public int getQuantity() {
       return quantity;
   }


   public void setQuantity(int quantity) {
       this.quantity = quantity;
   }

   @Override
   public String toString() {
       return "Botique [code=" + code + ", color=" + color + ", size=" + size + ", quantity=" + quantity
               + ", getCode()=" + getCode() + ", getColor()=" + getColor() + ", getSize()=" + getSize()
               + ", getQuantity()=" + getQuantity() + ", getClass()=" + getClass()
               + "]";
   }

   public static void main(String[] args) {
       // TODO Auto-generated method stub
       Botique obj=new Botique();
       obj.setCode("ABC");
       obj.setColor("RED");
       obj.setSize(6);
       obj.setQuantity(10);
       System.out.println(obj.toString());
   }

}

OUTPUT:


please give me thumb up


Related Solutions

Write a menu driven program in Java (OOP) That contain class for Botique. Data members include...
Write a menu driven program in Java (OOP) That contain class for Botique. Data members include code ,colour , size ,Quantity Your class should contains app accessors and mutators method Your class should contain Parametric and non-parametric constructors (use constructor chaining) Your class should have input and display method.
Write a C++ program test.cpp. The class should contain a protected int member variable var, which...
Write a C++ program test.cpp. The class should contain a protected int member variable var, which is initialized with an integer value between 1 and 50 in a constructor that takes an integer parameter. The class should contain a public member function called play that should print out a sequence of integers as a result of iteratively applying a math function f to the member variable var. The function f is defined as f(x) = (3x+1)/2 if x is odd...
Write Java code for extending the LinkedList<E> class of java.util.* to ExtLinkedList<E> that would include the...
Write Java code for extending the LinkedList<E> class of java.util.* to ExtLinkedList<E> that would include the following method: public ExtLinkedList <E> mergeThreeLists (ExtLinkedList<E> list1, ExtLinkedList<E> list2) { } that returns an ExtLinkedList<E> which is the merged version of values from thislist, followed by values from list1, and then followed by values from list2.    For example, if E is Integer type and this listhas (5,3,1), list1has (8, 10,12,14), and list2has (22,23,24,25,26) in that order, then the returned list from a call to...
JAVA 1 PROGRAMMING QUESTION In this program you will be writing a class that will contain...
JAVA 1 PROGRAMMING QUESTION In this program you will be writing a class that will contain some methods. These will be regular methods (not static methods), so the class will have to be instantiated in order to use them. The class containing the main method will be provided and you will write the required methods and run the supplied class in order to test those methods. ? Specifications There are two separate files in this program. The class containing the...
1.Write Java code for extending the LinkedList<E> class of java.util.* to ExtLinkedList<E> that would include the...
1.Write Java code for extending the LinkedList<E> class of java.util.* to ExtLinkedList<E> that would include the following method: public ExtLinkedList <E> mergeThreeLists (ExtLinkedList<E> list1, ExtLinkedList<E> list2) { } that returns an ExtLinkedList<E> which is the merged version of values from this list, followed by values from list1, and then followed by values from list2. For example, if E is Integer type and this list has (5,3,1), list1 has (8, 10,12,14), and list2 has (22,23,24,25,26) in that order, then the returned...
Write program#2 upload .java file. 2A) Write a java program that uses the Random class to...
Write program#2 upload .java file. 2A) Write a java program that uses the Random class to generate a number in the range 21 to 64.  Print the generated number. 2B) Using the Random class and nextInt(6), rolls two die generating two random numbers each in the range 1 through 6. Total by adding the two values together. Print the value of each die, and the total value. 2C) Using the Math class and sqrt(num), calculate the square root of integer twenty-two...
Write program#2 upload .java file. 2A) Write a java program that uses the Random class to...
Write program#2 upload .java file. 2A) Write a java program that uses the Random class to generate a number in the range 21 to 64.  Print the generated number. 2B) Using the Random class and nextInt(6), rolls two die generating two random numbers each in the range 1 through 6. Total by adding the two values together. Print the value of each die, and the total value. 2C) Using the Math class and sqrt(num), calculate the square root of integer twenty-two...
Java Write a Payroll class as demonstrated in the following UML diagram. Member variables of the...
Java Write a Payroll class as demonstrated in the following UML diagram. Member variables of the class are: NUM_EMPLOYEES: a constant integer variable to hold the number of employees. employeeId. An array of integers to hold employee identification numbers. hours. An array of integers to hold the number of hours worked by each employee payRate. An array of doubles to hold each employee’s hourly pay rate wages. An array of seven doubles to hold each employee’s gross wages The class...
Java Class Create a class with a main method. Write code including a loop that will...
Java Class Create a class with a main method. Write code including a loop that will display the first n positive odd integers and compute and display their sum. Read the value for n from the user and display the result to the screen.
Java Q1: Create a class named Triangle, the class must contain: Private data fields base and...
Java Q1: Create a class named Triangle, the class must contain: Private data fields base and height with setter and getter methods. A constructor that sets the values of base and height. A method named toString() that prints the values of base and height. A method named area() that calculates and prints the area of a triangle. Draw the UML diagram for the class. Implement the class. Q2: Write a Java program that creates a two-dimensional array of type integer...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT