DEV Community

AmalaReegan
AmalaReegan

Posted on

Day 15 Task 1

Task 1:

  1. Create a class called 'Jewellery'
  2. Create below static variables: static int goldPrice = 7100; static int silverPrice = 150; 2.1. Create below non-static variables int making_charges, wastage;
  3. Create main method.
  4. Inside main method, create instance as below Jewellery jewel1 = new Jewellery(); Jewellery jewel2 = new Jewellery();
  5. Using jewel1, assign making_charges and wastage.
  6. Using jewel2, assign making_charges and wastage.
  7. Call a non-static method as below. jewel1.bill(); jewel2.bill();
  8. Save, Compile and fix the error.
  9. Inside bill() method, print making_charges and wastage. #

Source code:

**package payilagam;

public class Jewellery {
static int goldPrice = 7100;
static int silverPrice = 150;
int making_charges, wastage;
public static void main(String[] args)
{
Jewellery jewel1 = new Jewellery();
Jewellery jewel2 = new Jewellery();
jewel1.bill(5000,500);
jewel2.bill(3000,200);
}
public void bill(int making_charges,int wastage)
{
System.out.println("making_charges"+" "+making_charges);
System.out.println("wastage"+" "+wastage);
}
}**

Output

Image description

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more