Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java 1 Barry Project 4: Message Display Terminal 1 Objective This project is the first time you'll create your own objects, along with methods, private

image text in transcribedimage text in transcribedimage text in transcribed

Java 1 Barry Project 4: Message Display Terminal 1 Objective This project is the first time you'll create your own objects, along with methods, private data, etc. This isn't a complete working system with user interaction; it's just a chance for you to create classes, then instantiate and test them?. You'll create two classes, one of which uses the other ("has-a" relationship). 2 About Message Display Terminal The display shows messages that are sent to it. It uses message content to determine the text, size, color, and length of time before the next message is displayed. 3 Objects You'll Create 3 Objects You'll Create Here is the UML Class Diagram for the objects you are to create, and how they relate to each other. Please pay attention to notation (including parameter and return types). There's a lot of information here; please understand it all (and ask questions if you're unclear) before starting to code! Display Message (you figure out this part) (you figure out this part) +Display() +Message(text: String) +Message(text: String, color: Color, fontSize : Integer, priority: Message Priority) +turn Off ) ->+turnOn() +clearDisplay) + showMessage(message: Message) > Message Priority +getText(): String +getColor(): Color +getFontSize(): Integer +getPriority(): MessagePriority Main +getisOn(): Boolean +getMessageCount(): Integer +getTotalMessageLength(): Integer -> +LOW +MEDIUM +HIGH +setText(text : String) +setColor(color: Color) +setFontSize(fontSize : Integer) +SetPriority(priority: Message Priority) -sleep(milliseconds: Integer) +toString(): String 1 You're writing Supplier code here, and not Client code. You'll create a simple Main as a demonstration, but that isn't considered a client deliverable and thus won't be graded. 6 Code Implementation Follow our Course Style Guide found in Canvas. 4 More Details about Display and Message 4.1 Message Messages consist of: 1. the text of the message 2. the color the text should appear 3. the font size that should be used for the text 4. the message priority (High, Medium, or Low) 7 Testing You don't need to test screen output; we don't have a good approach or technology for that. And since Main isn't a client deliverable, that doesn't need to be tested. Test everything else you can, however. Test constructors and preconditions. And don't forget test code is still code and can have bugs, so be suspicious if everything passes miraculously the first time, i.e., test that you can induce failures and get the appropriate error messages shown. The defaults for a Message should be (1) black text,(2) font size of 12, (3) low priority. Message Priority should be an enumerated type. These are discussed in slides, videos and in an appendix at the end of your textbook. Message's toString function should return the message text. 4.2 Display When started, the Display should show a picture of a computer monitor, with its "screen" portion set to a dark color (e.g., dark gray). When turned on, the display's screen portion should be a light color (e.g., white). When client code requests that the display show a message: 8 Extra Credit Without extra work, long messages will simply run off the end of the "screen" portion of the display, onto the monitor edges, and off into the ether afterwards; that's not ideal. For extra credit, fix that; back up, word by word, until the message fits". Remaining text should move to the next line (again, subject to fit and perhaps overflowing yet again). To assist with that, create a private method called display Line that takes parameters including the line to display, the font to use, the color to use, and the number of milliseconds to pause after displaying the text. It should return a string containing any overflow text, so that showMessage can iterate until the whole message has been displayed. None of the extra credit work should affect the Display's statistics regarding message lengths. You'll need to research the Graphics method getFontMetrics; this method will retrieve a FontMetrics object that will be very useful in determining the width of actual text. If the display is on it should display that message at the next available position on the screen, with the requested color and font size. Low-priority messages should remain on the screen for 25 seconds before the next message is displayed; medium, 5 seconds; high, 1 second. These messages affect message count and total length. If the text gets too low on the screen, call clear Display which, when the display is on, should draw a light-colored rectangle over the "screen" portion of the display. You may then continue to display text on the screen. If the display is off, no messages should be shown, counted, etc. Call clear Display which, when the display is off, will draw a dark-colored rectangle covering the "screen" portion of the display. You don't need to test the extra credit work; while interesting and necessary if this were production code, that's more work than I'm requesting for this project. 9 Submitting Your Work Use Blue) to create a .jar file. Be sure and specify "include source." Submit the jar file. Display's showMessage method maintains the appropriate internal counts and totals. Note that we aren't storing all messages as a group; we must handle necessary accounting at message display time. 5 Constraints and Assumptions Create no static methods. Mark each instance variable and each method as either public or private and use no other modifier); follow the UML where it gives guidance and make smart decisions where it doesn't. Use exactly the method names shown, or instructor test code may fail (if so, you'll lose points). Look carefully at the parameter data types and the return data types; they give you significant clues. Throw an illegalArgumentException if any of these preconditions are violated: o The "usual suspects" are misused (null or empty strings, null object or enumerated type references) 10 Hints Don't duplicate code; avoid this wherever possible. As an example, don't forget it's legal and proper) for one constructor to call another constructor, this is good practice and helps avoid duplication and the creation of extra code paths to test. Everything you write in this project is Supplier code. You should not ask questions of the user nor print anything out for them to see. Provide a simple Main class (with a runnable main method) to show a quick demo; printing in this code is fine (and expected). 2 You should find a picture on the internet (e.g., a JPEG file). Find content that is licensed under Creative Commons, so as not to misuse intellectual property. You aren't responsible for handling single-word strings that won't fit on a line; if they spill over, that's okay. Java 1 Barry Project 4: Message Display Terminal 1 Objective This project is the first time you'll create your own objects, along with methods, private data, etc. This isn't a complete working system with user interaction; it's just a chance for you to create classes, then instantiate and test them?. You'll create two classes, one of which uses the other ("has-a" relationship). 2 About Message Display Terminal The display shows messages that are sent to it. It uses message content to determine the text, size, color, and length of time before the next message is displayed. 3 Objects You'll Create 3 Objects You'll Create Here is the UML Class Diagram for the objects you are to create, and how they relate to each other. Please pay attention to notation (including parameter and return types). There's a lot of information here; please understand it all (and ask questions if you're unclear) before starting to code! Display Message (you figure out this part) (you figure out this part) +Display() +Message(text: String) +Message(text: String, color: Color, fontSize : Integer, priority: Message Priority) +turn Off ) ->+turnOn() +clearDisplay) + showMessage(message: Message) > Message Priority +getText(): String +getColor(): Color +getFontSize(): Integer +getPriority(): MessagePriority Main +getisOn(): Boolean +getMessageCount(): Integer +getTotalMessageLength(): Integer -> +LOW +MEDIUM +HIGH +setText(text : String) +setColor(color: Color) +setFontSize(fontSize : Integer) +SetPriority(priority: Message Priority) -sleep(milliseconds: Integer) +toString(): String 1 You're writing Supplier code here, and not Client code. You'll create a simple Main as a demonstration, but that isn't considered a client deliverable and thus won't be graded. 6 Code Implementation Follow our Course Style Guide found in Canvas. 4 More Details about Display and Message 4.1 Message Messages consist of: 1. the text of the message 2. the color the text should appear 3. the font size that should be used for the text 4. the message priority (High, Medium, or Low) 7 Testing You don't need to test screen output; we don't have a good approach or technology for that. And since Main isn't a client deliverable, that doesn't need to be tested. Test everything else you can, however. Test constructors and preconditions. And don't forget test code is still code and can have bugs, so be suspicious if everything passes miraculously the first time, i.e., test that you can induce failures and get the appropriate error messages shown. The defaults for a Message should be (1) black text,(2) font size of 12, (3) low priority. Message Priority should be an enumerated type. These are discussed in slides, videos and in an appendix at the end of your textbook. Message's toString function should return the message text. 4.2 Display When started, the Display should show a picture of a computer monitor, with its "screen" portion set to a dark color (e.g., dark gray). When turned on, the display's screen portion should be a light color (e.g., white). When client code requests that the display show a message: 8 Extra Credit Without extra work, long messages will simply run off the end of the "screen" portion of the display, onto the monitor edges, and off into the ether afterwards; that's not ideal. For extra credit, fix that; back up, word by word, until the message fits". Remaining text should move to the next line (again, subject to fit and perhaps overflowing yet again). To assist with that, create a private method called display Line that takes parameters including the line to display, the font to use, the color to use, and the number of milliseconds to pause after displaying the text. It should return a string containing any overflow text, so that showMessage can iterate until the whole message has been displayed. None of the extra credit work should affect the Display's statistics regarding message lengths. You'll need to research the Graphics method getFontMetrics; this method will retrieve a FontMetrics object that will be very useful in determining the width of actual text. If the display is on it should display that message at the next available position on the screen, with the requested color and font size. Low-priority messages should remain on the screen for 25 seconds before the next message is displayed; medium, 5 seconds; high, 1 second. These messages affect message count and total length. If the text gets too low on the screen, call clear Display which, when the display is on, should draw a light-colored rectangle over the "screen" portion of the display. You may then continue to display text on the screen. If the display is off, no messages should be shown, counted, etc. Call clear Display which, when the display is off, will draw a dark-colored rectangle covering the "screen" portion of the display. You don't need to test the extra credit work; while interesting and necessary if this were production code, that's more work than I'm requesting for this project. 9 Submitting Your Work Use Blue) to create a .jar file. Be sure and specify "include source." Submit the jar file. Display's showMessage method maintains the appropriate internal counts and totals. Note that we aren't storing all messages as a group; we must handle necessary accounting at message display time. 5 Constraints and Assumptions Create no static methods. Mark each instance variable and each method as either public or private and use no other modifier); follow the UML where it gives guidance and make smart decisions where it doesn't. Use exactly the method names shown, or instructor test code may fail (if so, you'll lose points). Look carefully at the parameter data types and the return data types; they give you significant clues. Throw an illegalArgumentException if any of these preconditions are violated: o The "usual suspects" are misused (null or empty strings, null object or enumerated type references) 10 Hints Don't duplicate code; avoid this wherever possible. As an example, don't forget it's legal and proper) for one constructor to call another constructor, this is good practice and helps avoid duplication and the creation of extra code paths to test. Everything you write in this project is Supplier code. You should not ask questions of the user nor print anything out for them to see. Provide a simple Main class (with a runnable main method) to show a quick demo; printing in this code is fine (and expected). 2 You should find a picture on the internet (e.g., a JPEG file). Find content that is licensed under Creative Commons, so as not to misuse intellectual property. You aren't responsible for handling single-word strings that won't fit on a line; if they spill over, that's okay

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

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

4 How can you create a better online image for yourself?

Answered: 1 week ago