Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java and for the test cases junit 4 1. This problem concerns a class TelephoneMemory, which models the telephone system responsible for saved numbers. Specifically

image text in transcribed
Java and for the test cases junit 4
1. This problem concerns a class TelephoneMemory, which models the telephone system responsible for saved numbers. Specifically it can store saved numbers 0 through 9. The class has the following methods: A constructor that creates a memory whose only saved number is number 1, which starts with the value "123-4357" (123-HELP). This is the customer service number for the company selling the phone. (Note that we're representing the phone numbers as strings. This system always uses strings: just assume that all strings entered into the system are valid.) A method set that takes an integer and a string. It will make that string the new value for the saved number identified by the integer. For example, set(3, "123-4567") will sct saved number 3 to "123-4567". The integer must be in the range 0-9 or the method will throw an IndexOutOfBoundsException. The method should return whether that saved number had been previously sct. A method dial that takes an integer and returns the value of that saved number. If the value given is invalid (either not in the range 0 9 or not set), then the method will throw a NoSuchElementException. Based on this description, complete the following (a) (6 points) Write a "stub" version of PhoneMemory. It should be a class with this name that has methods matching these descriptions and that compiles, but with minimal code to compile. (No effort needs to be made to properly implement the functionality.) (b) (20 points) Write JUnit test cases for PhoneMemory. All properties of the class should be thoroughly tested

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

Data Analytics And Quality Management Fundamental Tools

Authors: Joseph Nguyen

1st Edition

B0CNGG3Y2W, 979-8862833232

More Books

Students also viewed these Databases questions