Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

question#1: java class question#2: find error One variation of the PhoneNumber class of Lab 3.2 is to represent the phone number as three integers for

question#1: java class
image text in transcribed
question#2: find error
image text in transcribed
One variation of the PhoneNumber class of Lab 3.2 is to represent the phone number as three integers for the individual components: area-code, exchange and line number. Here is a specification for such a class 1. State three integer variables representing the area code, exchange, and line- number of the phone number o Behavior a constructor that accepts three integers representing the area code, exchange, and line number respectively a constructor that accepts two integers -the exchange and line number, and sets the area code to 800. To receive full credit for this you must invoke the three parameter constructor getAreaCode, getExchange, and getlineNumber methods an equale method that returns whether two PhoneNumber objects are equal (i.e., their area code, exchange, and line numbers are all equal). A tostring method that returns the phone number in the format o o o o o a read method that reads in three integers, and uses them to crcate and initialize a PhoneNumber object (sing the three-parm constructor), and returns the new object o Provide the class definition of such a PhoneNumber class. Make sure you inchude public and private, and use them appropriately. (20 points) a. 9. What is wrong with each of the following programs? 1 public class ShowErrors 1 public class ShowErrors 1 2 public static void main(String[] args) 2 public static void main(String[] args) ShowErrors t new ShowErrors(5); ShowErrors t t.xO new ShowErrors(); 4 1 public class ShowErrors 2 public void method10 1 public class ShowErrors 2 public static void main(String[] args) Circle c; System.out.printlnC What is radius" C c new C(S.0); System.out.println(c.value); + c.getRadiusO); c new CircleO 8 class C int value = 2; 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions