Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Science an INTRODUCTION In this assignment you will implement class Printer, which represents a real-ife computer printer Your class Printer the following attributes (membervariables) Tpe:

image text in transcribed
image text in transcribed
Science an INTRODUCTION In this assignment you will implement class Printer, which represents a real-ife computer printer Your class Printer the following attributes (membervariables) Tpe: Dor Matri. Ink Jet, or Laser (enam data type ON or OFF Boolean value) Printer Capacity: the mavimum number of pages that can be loaded into a printer (integer) Paper Load current number of pages loaded into a printer (inleger) Class Printer contains the following FUNCTIONS CONSTRUCTORS: Ddawlreansmactor. Default attribune values are: ype Do Matrix o Printer Cupacio 1,000 Status OFF Paper Lead-1,000 Class Constructor: takes four arguments, one for each class attribute, makesmnr thar the arguments for paper capacity and paper load are valid fin other words yow must validate the Printer capacity-an integer value between 500 and Io000 o Paper Load-and integer value between 0 and Paper Cpacity Input printer takes input from the keyboard (a user) to set a printer object and validates attribute values (member variable values) of the class Accepts parameters Retums Nothing Display Printer displays printer information screen ACCESSOR MEMBER NCTIONS: Ger Type: returns the type of the printer GeLSwannsr returns a Boolean value indicating ifthe printer isoN or oFF Get Capacies returns printer's page capacity Get Leedt returns current printer's page load FIER M RER FUNCTIONS: Print prints specified number of pages (eg sheets of paper. Function takes a single integer value (as an argument)to represent the number of pages to print Printing rules f the printer is OFF retum If the number of pages to print islarger than the Paper Load then the function sets Paper Load to 0 and returns the num ber of pages (int)left to print. Otherwise, the function decrements the PaperLead by the number of pages to print and returns 0 Load: loads specified number of pages into a printer Function takes a single int value as an argunent to represent the number to load. Loading rules f the printer's available capacity (eg the difference between the Printer Capacio and the Load is greater than the requested number of pages to load, then the function increments the Paper Load by the specified number of pages returns o otherwise, the function sets Paper Load to the Printer Capacity and returns the number of pages that were NOT loaded lenovo

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

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago