Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help write actual seperate java code programs for the following 5 examples: 2.1 Example 1 A town contains 5000 houses. Each house owner must

Please help write actual seperate java code programs for the following 5 examples:

2.1 Example 1

A town contains 5000 houses. Each house owner must pay tax based

on the value of the house. Houses over $200 000 pay 2% of their value

in tax, houses over $100 000 pay 1.5% of their value in tax and houses

over $50 000 pay 1% of their value in tax. All others pay no tax. Write

an algorithm to solve this problem in the form of a java code program.

2.2 Example 2

The following formula is used to calculate n: n = (x * x)/(1 - x). The

value x = 0 is used to stop the algorithm. The calculation is repeated

using values of x until the value x = 0 is input. There is also a need to

check for error conditions. The values of n and x should be output.

Write an algorithm to show this repeated calculation in the form of a

java code program.

2.3 Example 3

Write an algorithm in the form of a java code program which takes temperatures

input over a 100 day period (once per day) and outputs the number of

days when the temperature was below 20C and the number of days

when the temperature was 20C and above.

2.4 Example 4

Write an algorithm in the form of a java code program which:

inputs the top speeds (in km/hr) of 5000 cars

outputs the fastest speed and the slowest speed

outputs the average (mean) speed of all the 5000 cars

2.5 Example 5

A shop sells books, maps and magazines. Each item is identified by a

unique 4 - digit code. All books have a code starting with 1, all maps

have a code starting with 2 and all magazines have a code starting with

3. The code 9999 is used to end the algorithm.

Write an algorithm in the form of a java program which inputs the codes for

all items in stock and outputs the number of books, number of maps and

the number of magazines in stock. Include any validation checks

needed.

Thanks

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions