联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2018-10-13 10:27

COM6471 Assignment 1: Simple Formatting

Dr Ramsay G Taylor

October 5, 2018

1 Outline

This is the first assignment for COM6471 Foundations of Object Oriented Programming,

worth 10% of your final module mark. This is a relatively simple

assignment and is intended to introduce you to producing Java code in a form

that can be submitted, and that can be understood and used by other people.

The specific tasks are described in Section 2, but the objective is to do some

simple text formatting. Figure 1 shows a raw text file with multiple lines, some

of which are Chapter headings, some are Section headings, and some are plain

text rows. There is no formatting to this text file, its just lines of text.

A slightly more beautiful format is shown in Figure 2. In this format:

Every line that starts with “Chapter” is preceded by two blank lines.

Every line that starts with “Section” is preceded by one blank line, and

is indented by either one tab character or four space characters.

Every line that doesn’t start with either “Chapter” or “Section” is indented

by two tab characters or eight space characters.

This is what we want you to produce with your program.

1

Chapter 1: Introduction

Section 1.1: Introducing the Introduction

Blah blah text here more text blah.

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

sed do eiusmod tempor incididunt ut

labore et dolore magna aliqua. Ut enim ad minim

veniam, quis nostrud exercitation ullamco

laboris nisi ut aliquip ex ea commodo consequat.

Section 1.2: Concluding the Introduction

Duis aute irure dolor in reprehenderit in

voluptate velit esse cillum dolore eu fugiat nulla

pariatur. Excepteur sint occaecat cupidatat

non proident, sunt in culpa qui officia deserunt

mollit anim id est laborum.

Chapter 2: Some other stuff

Section 2.1: Stuffing

Sed ut perspiciatis unde omnis iste natus error sit

voluptatem accusantium doloremque

laudantium, totam rem aperiam, eaque ipsa quae

ab illo inventore veritatis et quasi architecto

Section 2.2: Sage

beatae vitae dicta sunt explicabo. Nemo enim

ipsam voluptatem quia voluptas sit aspernatur

aut odit aut fugit, sed quia consequuntur magni

dolores eos qui ratione voluptatem sequi nesciunt.

Neque porro quisquam est, qui dolorem ipsum

quia dolor sit amet, consectetur, adipisci velit, sed

quia non numquam eius modi tempora incidunt

ut labore et dolore magnam aliquam quaerat

Section 2.3: Onion

voluptatem. Ut enim ad minima veniam, quis

nostrum exercitationem ullam corporis suscipit

laboriosam, nisi ut aliquid ex ea commodi

consequatur? Quis autem vel eum iure reprehenderit

qui in ea voluptate velit esse quam nihil

molestiae consequatur, vel illum qui dolorem eum

fugiat quo voluptas nulla pariatur?

Figure 1: An example of the input format

2

Chapter 1: Introduction

Section 1.1: Introducing the Introduction

Blah blah text here more text blah.

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

sed do eiusmod tempor incididunt ut

labore et dolore magna aliqua. Ut enim ad minim

veniam, quis nostrud exercitation ullamco

laboris nisi ut aliquip ex ea commodo consequat.

Section 1.2: Concluding the Introduction

Duis aute irure dolor in reprehenderit in

voluptate velit esse cillum dolore eu fugiat nulla

pariatur. Excepteur sint occaecat cupidatat

non proident, sunt in culpa qui officia deserunt

mollit anim id est laborum.

Chapter 2: Some other stuff

Section 2.1: Stuffing

Sed ut perspiciatis unde omnis iste natus error sit

voluptatem accusantium doloremque

laudantium, totam rem aperiam, eaque ipsa quae

ab illo inventore veritatis et quasi architecto

Section 2.2: Sage

beatae vitae dicta sunt explicabo. Nemo enim

ipsam voluptatem quia voluptas sit aspernatur

aut odit aut fugit, sed quia consequuntur magni

dolores eos qui ratione voluptatem sequi nesciunt.

Neque porro quisquam est, qui dolorem ipsum

quia dolor sit amet, consectetur, adipisci velit, sed

quia non numquam eius modi tempora incidunt

ut labore et dolore magnam aliquam quaerat

Section 2.3: Onion

voluptatem. Ut enim ad minima veniam, quis

nostrum exercitationem ullam corporis suscipit

laboriosam, nisi ut aliquid ex ea commodi

consequatur? Quis autem vel eum iure reprehenderit

qui in ea voluptate velit esse quam nihil

molestiae consequatur, vel illum qui dolorem eum

fugiat quo voluptas nulla pariatur?

Figure 2: An example of the desired output

3

2 Task

You should produce a single Java Class with a single main method, with the

following behaviour:

1. When the Java program is run it should take one argument at the command

line, which is the name of the input file.

2. You should open that file and begin to read lines.

3. You should print each line to the standard output in the form shown in

Figure 2, and add blank lines and tab/space characters as described above.

4. You should do this for every transaction in the file.

Some things to consider:

You can use the EasyReader class to read files.

You can use the EasyWriter class to help format the output.

The file may contain one or more blank lines.

You are expected to present your code in a helpful and professional way —

this includes sensible layout, helpful and conventional choices for variable

names, and some comments to describe the main method overall, and at

a few places in the code to explain what is going on.

3 Submission and Marking

You should submit your .java files through MOLE. You should upload the

.java file that contains your code.

The marking scheme will be as follows:

70 — 100% A program that produces almost exactly the desired output,

and code that is clean and clear and commented.

60 — 70 A program that runs and produces something approximating

the required output. Some comments and sensible layout

and naming.

50 — 60 A class with a main method that compiles and runs. At

least fairly readable code.

40 — 50 A basic class and main method with some mistakes that

stop it compiling, but some evidence that you understand

what you are doing.

0 — 40 Credit given for whatever is present.

You should notice that this mark scheme is only partially about whether

or not the code works and produces the desired output. At least some of the

4

marks are for having code that is readable and clear and well formatted. Code

blocks within methods and within if and while statements should be indented.

Variables should have descriptive names. There should be a few comments

around significant sections of the code to explain what they are doing. There

isn’t a specific coding standard but you will be penalised for confusing or messy

code.

You are reminded that the University of Sheffield takes the use of

unfair means very seriously. The code you present for this assignment must

be entirely your own work. Code that is plagiarised — that is, copied from

somewhere else — is not acceptable and you will receive zero for this assignment

and be called to a departmental unfair means panel where it will be investigated

further.

Since the purpose of these assignments is to test your knowledge of Object

Oriented design and Java, you must also avoid collusion — that is, discussing

your design or implementation with your classmates to such a degree that you

end up submitting similar work. Even if you have produced the code independently,

part of the object of the assignment is to evaluate your Object Oriented

design approach, so you must develop your solution independently.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp