
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for creating a java class named message with two private instance variables: text (string) and cost (double). The class includes a default constructor, a constructor with two parameters, a copy constructor, a tostring method, an equals method, and a static append method. The append method takes two message objects as parameters and returns a new message object with the concatenated text and the sum of costs.
Typology: Quizzes
1 / 1
This page cannot be seen from the preview
Don't miss anything!

CMSC131 Spring 2005 Quiz #5, Duration 15 Minutes
First Name: Last Name: Student Id: cs131 _ _ _
Section time (circle one): 8 AM 9 AM 10 AM 11 AM 12 PM 1 PM
Problem Description
Write a complete Java class named Message. The class has two private instance variables named text (String) and cost (double) which represent the message’s text and cost , respectively. All the methods of the class are non- static except the method named append (described below). The methods you must implement are:
Restrictions/Assumptions
BEGIN YOUR IMPLEMENTATION HERE (CONTINUE ON THE BACK IF NECESSARY)