FIND A SOLUTION AT Academic Writers Bay

1

CSP2151: Workshop 2

—————————————————————————————————————

Non-assessable tasks:

Design or evaluate as appropriate

1) When is each of these expressions true?

5<x

5<x && x<=10

5<x && x<=10 || 15<x && x<=20

month==4 || month==6 || month==9 || month==11

year%4==0 && (year%100!=0 || year%400==0)

2) What is the value of this expression?

1 + 2 * 3 && 4 – 5 || 6 <= 7 % 8 != ! 9 / 10 > 11

3) Under Australian taxation law, annual income is described as in the table below. In addition,

a Medicare levy of 2.0 cents in the dollar is applied to all income. Write a program that will,

for a given gross income, output what net income will be received.

Taxable

income

Tax on this income

0 – $18,200

Nil

$18,201 – $37,000

19c for each $1 over $18,200

$37,001 – $90,000

$3,572 plus 32.5c for each $1 over $37,000

$90,001 – $180,000

$20,797 plus 37c for each $1 over $90,000

$180,001 and over

$54,097 plus 45c for each $1 over $180,000

4) Write a function, called int sum_to_100(), that uses a loop to calculate the sum of the

numbers from one to a hundred.

Design and Implement the following:

1) Write a program that reads in 2 numbers from the console, offers a choice of mathematical

operation and then displays the result of the requested operation. The program should ask

if the user wishes to quit and repeat until it gets a set value.

2) Write a function int_max_3 that takes three int arguments and returns the largest of them

as the value of the function.

3) Write a function that rolls a number of six-sided dice and returns the sum of the rolls. Then

write a program that uses that function to roll a thousand dice and output the results.

An example

James Mars with a taxable income

of $50,000 would pay $7,797.00 tax.

The income places him into the

third row of the table, hence:

$3,572+$0.325 * ($50,000 -$37,000)

2

—————————————————————————————————————-

Assessable tasks:

Your next assessable task is to continue creation of the robotics competition simulation.

The competition consists of three phases.

1. Speed. The robots will race to reach the finish line.

2. Strength. The robots will attempt to lift several heavy objects.

3. Combat effectiveness. The robots will battle against 100 humans and then

receive a score based on the number of victories.

Robot winning criteria: A robot wins a combat if its performance score is greater

than its human opponent’s and loses otherwise.

For simplicity, we assume that the robot’s performance score is a random number

between its maximum and minimum percentage chances of winning, and the

human opponent’s performance score is a random number between 0 and 100

(inclusive).

A robot’s percentage chances of winning in a combat can be calculated using the

following formula:

minspeed, 60 + (

- Assignment status: Already Solved By Our Experts
*(USA, AUS, UK & CA PhD. Writers)***CLICK HERE TO GET A PROFESSIONAL WRITER TO WORK ON THIS PAPER AND OTHER SIMILAR PAPERS, GET A NON PLAGIARIZED PAPER FROM OUR EXPERTS**

QUALITY: 100% ORIGINAL PAPER – **NO PLAGIARISM** – CUSTOM PAPER