Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new Java Project. 1) Create a class for Camera Store, which is having a digital camera sale. The class is named DigitalCamera, and

Create a new Java Project.

1) Create a class for Camera Store, which is having a digital camera sale. The class is named DigitalCamera, and it contains data fields for a brand, the number of megapixels in the resolution, and price. Include a constructor that takes arguments for the brand and megapixels.

If the megapixel parameter is greater than 10, the constructor sets it to 10.

The sale price is set based on the resolution; any camera with 6 megapixels or fewer is $99, and all other cameras are $129. Also include a method that displays DigitalCamera details.

2) Write an application named TestDigitalCamera in which you instantiate one objects, prompt the user for values for the camera brand and number of megapixels, and display all the values.

Save the files as DigitalCamera.java and TestDigitalCamera.java.

-------------------------------------------

Each output below is a different run.

-------------------------------------------

Sample Output 1:

Enter camera brand Nikon

Enter megapixels 11

Camera brand: Nikon resolution: 10 megapixels, Sale price $129.0

---------------------------------------------------------------------------

Sample Output 2:

Enter camera brand Nikon

Enter megapixels 6

Camera brand: Nikon resolution: 6 megapixels, Sale price $99.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

Explain the process of recruitment and selection.

Answered: 1 week ago