## (solution) Can you help me to do these or guide me? I have no idea about

Can you help me to do these or guide me? I have no idea about these questions.

ICT104 Assignment 1 1 MURDOCH UNIVERSITY

ICT104 Principles of Computer Science

Assignment 1 (worth 20% for the unit)

All Students: Submit the Assignment via LMS by the due date. Please carefully read ?Assignment 1

Submission Instructions? and submit your assignment strictly in accordance to the instruction. Failure to

adhere to the instructions may result in the fail of your assignment, and in the worst case your

assignment may not even be accepted.

Late penalty: 10% per day penalty for delayed submissions unless prior extension of deadline is

obtained from the unit coordinator.

You should keep a copy of your work. Your submission must include a completed assignment cover

sheet. An electronic copy of the assignment cover sheet is available at the unit LMS site.

This assignment consists of three questions. All questions are worth equal marks.

Note that none of the questions require the use of arrays. Question 1.

Design, write in Java, test and document a program that computes the monthly payment and the total

payment for a bank loan. The program lets the user enter the loan amount (a floating point value of

type double), the loan period (an integer) in number of years, and a range of annual interest rates (two

floating point values). The program displays the monthly and total payments for each interest rate

within the given range, with an increment of 1/4. For example, if the user enters the loan amount

10000 for five years, with interest rates 5.00% and 8.00%, the program should display a table as

follows:

Loan Amount: 10000

Number of Years: 5

Interest Rate Monthly Payment Total Payment 5.00% 188.71 11322.74 5.25% 189.85 11391.59 7.75% 201.56 12094.17 8.00% 202.76 12165.83 ?..

?.. The monthly and total repayments are to be displayed correct to two decimal places. The input data is

to be validated. If the user enters a zero or negative value, the program should output an appropriate

error message and re-prompt for input until the user enters the correct data.

Also, be sure to adjust the interest rate for the monthly period. For example, when annual interest rate

is 5 percent, then when posting monthly interest rate, you use 5/12 percent.

The formula to compute the monthly payment is as follows:

monthlyPayment =

(loanAmount x monthlyInterestRate) / (1 ? (1 / (1 + monthlyInterestRate) numberOfYears x 12 )) ICT104 Assignment 1 2 In the above formula, you have to compute (1 + monthlyInterestRate) numberOfYears x 12 b ). The pow(a,b) method in the Java API Math class can be used to compute a .

The program should loop around and allow the user to repeat the above calculations for another

set of input data until the user does not want to continue.

The program should be well-structured and should have a reasonable set of methods in addition to the

main method. It should use a good coding style, proper indentation, meaningful identifier names and

The program should also include a method (eg, StudentInfo( )) to output your student details (name,

student number, mode of enrolment (i.e., internal or external), tutor name, tutorial attendance day and

time) at the start of program results.

Devise suitable test data (in addition to the above example) to test your program. The test data together

with test results should be submitted as part of your external documentation. Question 2.

A television rating service makes a telephone survey of the viewing audience to sample the popularity

of TV shows. When a call is made concerning a particular show, the age (in the range 1 to 120) and

gender (male/female) of the person called, as well as whether that person watches the show regularly

(Y/N), are recorded.

Design, write in Java, test and document a program to process the data gathered for a show. The

program is to output the total number of people called, the number who said they watch the show

regularly, and the percentage of those who watch the show regularly as in the example below.

The total number of people called = 20

The number of people who watch the show regularly = 8

The percentage of those who watch the show regularly = 40% The program should also print a table showing the percentages of those who watch the show regularly

according to gender and age categories as in the example below.

Distribution of viewers who watch the show regularly

-------------------------------------------------------------------------------------------------Gender

% Under 30

% 30 or Over

% Total

-------------------------------------------------------------------------------------------------Female 44 17 61 Male

23

16

39

-------------------------------------------------------------------------------------------------Total 67 33 100 The percentages in the table are rounded to the nearest whole number and are percentages of all those

who watch the show regularly. Thus, the sum of percentages in the last column of the table must be

100% (ignoring any rounding error).

Sample input:

Please enter next person?s age (1..120):

25

Please enter this person?s gender (M/F):

M ICT104 Assignment 1 3 Please enter whether this person watches the show regularly (Y/N):

Y

Do you want to enter another person?s details (Y/N)?

Y

The program should repeat until the user does not want to enter any more survey data for a particular

show.

The input data is to be validated. For example, if the user types in an integer outside the range 1 to 120

(for age), a letter other than ?M? or ?m? (for male), ?F? or ?f? (for female), ?Y? or ?y? (watches

regularly), ?N? or ?n? (does not watch regularly), the program should output an appropriate error

message and re-prompt for input until the user enters the correct data.

In order to input a character (to get a ?y/n? user response) see the last page of Week 2 Lab Practice

sheet.

Your program should have an outer loop that allows the user to repeat the above processing for a

different show. The processing is repeated until the user indicates that they want to end the program.

The program should be well-structured and should have a reasonable set of methods in addition to the

main method.

Devise suitable test data to test all sections of program code. The test data together with test results

should be submitted as part of your external documentation.

The program should also include a method (eg, StudentInfo( )) to output your student details (name,

student number, mode of enrolment (i.e., internal or external), tutor name, tutorial attendance day and

time) at the start of program results.

Note that this question does not require you to define a separate class for the person record and a

separate client program. However you are welcome to do so if you wish.

Also note that the question does not require the use of arrays. Question 3.

Design, write in Java, test and document a program to calculate the number of minutes between one

time and another. Here are some examples:

TIME DIFFERENCE

Enter first time ( hh: mm a/pm): 12:56pm

Enter second time ( hh: mm a/pm): 1:03pm

The difference is 7 minutes

Do you wish to continue (Y/N)?

Y

TIME DIFFERENCE

Enter first time ( hh: mm a/pm): 1:03pm

Enter second time ( hh: mm a/pm): 12:56pm

The difference is 1433 minutes ICT104 Assignment 1 4 Do you wish to continue (Y/N)?

Y

TIME DIFFERENCE

Enter first time ( hh: mm a/pm): 1:03pm

Enter second time ( hh: mm a/pm): 12:65pm

ERROR: the second time is not valid

Do you wish to continue (Y/N)?

Y

TIME DIFFERENCE

Enter first time ( hh: mm a/pm): 8:30 am

Enter second time ( hh: mm a/pm): 5:30 pm

The difference is 540 minutes

Do you wish to continue (Y/N)?

N

The times are to be entered (on one line) in the 12 hour format with hours (1-2 digits), colon, minutes

(2 digits) and then the string ?am? or ?pm?. You may also allow spaces.

The program should be well-structured and should have a reasonable set of methods in addition to the

main method. It should use a good coding style, proper indentation, meaningful identifiers and

The program should also include a method (eg, StudentInfo( )) to output your student details (name,

student number, mode of enrolment (i.e., internal or external), tutor name, tutorial attendance day and

time) at the start of program results.

Devise suitable test data to test all sections of program code. The test data together with test results

should be submitted as part of your external documentation.

Hint:

1. You may consider using the following methods from the Java String class:

indexOf(int char)

indexOf(int char, int fromIndex)

indexOf(String str)

indexOf(String str, int fromIndex)

to work out the index position of a character or a substring within a string;

2. and then use

substring(int beginIndex, int endIndex)

substring(int beginIndex)

to extract the different parts of a string;

3. and then use wrapper Integer class method Integer.parseInt(String str) to convert the string

such as ?12? into its numerical representation (see pages 447-452 of Savitch 7th Edition or

Topic 4 Lecture notes). ICT104 Assignment 1 5 Distribution of marks for assessment

For each of the programming questions, an approximate distribution of marks for assessment is given

below. Each question will be marked out of 50 as follows (and then averaged according to the actual

marks for each question):

Correct solution design and implementation: 25 marks Programming style (internal documentation (comments), use of methods, parameters, input

validation, readability, presentation of output etc.):

12.5 marks

External Documentation (problem specification, algorithm, program limitations, program

listings, program testing and test results etc.):

12.5 marks

For internal documentation (ie in the source code) we require:

?

?

? a beginning comment clearly stating title, author, date, file name, purpose and any assumptions or

conditions on the form of input and expected output;

other comments giving useful low-level documentation and describing the each component;

well-formatted readable code with meaningful identifier names and blank lines between

components (like methods and classes). Each program should also include a method (eg, StudentInfo( )) to output your student details (name,

student number, mode of enrolment, tutor name, tutorial attendance day and time) at the start of

program output.

Required External Documentation for each question:

1. Title: a paragraph clearly stating title, author, date, file names, and one-line statement of purpose.

2. Requirements/Specification: a paragraph giving a brief account of what the program is supposed

to do. State any assumptions or conditions on the form of input and expected output.

3. User Guide: include clear instructions on how to access, compile and run the program.

4. Structure/Design/Algorithm: Outline the design of your program. Give a written description, use

diagrams and use pseudocode for algorithms.

5. Limitations: Describe program shortfalls (if any), eg, the features asked for but not implemented,

the situations it can not handle etc.

6. Testing: describe your testing strategy (the more systematic, the better) and any errors noticed.

Provide a copy of your results of testing in a document saved in Word format. Note that a copy of

the sample test data and results from a program run for each program is required (copy

from the program output window and paste to a Word file). Your submitted test results

should demonstrate a thorough testing of the programs.

7. Source program listings: save all your Java source code in a document in MS Word format.

All of the above external documentation for a question must be included in that order in a file saved in

MS Word format. Your final external documentation submission should be prepared as a single Word

document containing each of the questions in order and each section within these also in order.

It is also necessary to submit the Java source code and compiled version of your programs (i.e., all

classes that you have designed and implemented). You should develop the programs using the

NetBeans IDE. It will make it easy to collect sample output. The whole NetBeans project(s) should be

submitted.

The external documentation together with the source code files and compiled versions for all questions

must be compressed in a .zip file before submitting. Note that the whole NetBeans project folders can

be zipped. Make sure that all necessary files are submitted so that the programs can be viewed,

compiled and run successfully. ICT104 Assignment 1 6 The final versions of the programs should compile and run under Java SE 8 (JDK 8). Internal students

should test compilation and running on the University lab machines.

Associate Professor Dr Kevin Wong

ICT104 Unit Coordinator

Solution details:
STATUS
QUALITY
Approved

This question was answered on: Jan 30, 2021

Solution~0001001036.zip (25.37 KB)

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free solution (Deadline assured. Flexible pricing. TurnItIn Report provided)

STATUS

QUALITY

Approved

Jan 30, 2021

EXPERT

Tutor