Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A simple spreadsheet is a grid of cells. Each cell can contain one of four possible things: 1. Nothing - the cell might be empty;

A simple spreadsheet is a grid of cells. Each cell can contain one of four possible things:

1. Nothing - the cell might be empty;

2. A fixed string, used as a label;

3. A fixed numerical value, represented as a double;

4. A formula, as discussed below, which will evaluate to a number.

The sorts of formulae to be supported to start with are very limited, but it is expected that later developments will add more options. For now, a formula can indicate that the value in a cell is the sum of two other values whose coordinates are specified relative to the cell being considered. If one of the cells so addressed is empty, contains a string or is off the edge of the grid then it will be treated as if it contains zero. Somewhere in the spreadsheet program there will need to be methods that make it possible to set the type of content of a cell, and to process the formulae until all values are up to date. They may of course need a number of additional fields and methods not explicitly noted in this specification.

(i)Design a set of Java classes that you can use to represent this set-up. Explain what fields and methods each will have, and what needs to be public and what can be kept private. At this stage you do not need to implement any elaborate methods, but you should explain what your methods must achieve.[7 Marks]

(ii)Sketch an implementation of the methods involved in causing the spreadsheet to bring all its values up to date after the user alters the value in one cell.[7 Marks]

Describe the facilities in Java for defining classes and for combining them through composition, inheritance and interfaces. Explain with a worked example how they support the principle of encapsulation in an object-oriented language. [9 Marks]

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions