CS46A Spring 18

7A

Companies report net income every quarter of the year. Some quarters Amazon's net income per share is positive, and some quarters it is negative. (It is always small because Amazon reinvests any profits in the business.)

Write an application (A program that has a main methods) called AmazonNetIncome to read a collection of integers, each representing a positive, negative or 0 net income for the quarter for 100 shares of Amazon stock. The input will terminate when the user enters a non-integer.

Use this prompt: System.out.print("Enter net income or Q to quit: ");

Note: you will actually quit on any string that can not be converted  to an int.

Do the following:

Only print the numbers if at least 1 integer was entered. Otherwise print "No values entered"

You will read the inputs one at a time and do all the processing as you go. No Arrays for this

The outputs should be on separate lines and in this order

Do not initialize the minimum to 0 or some negative number. You can temporarily set it to 0 when you declare it but then initialize to the first input. You can use a boolean variable as a flag as discussed in the videos.

No Javadoc required when there is only a main method.

For the draft, read the numbers and print them, one to a line. Quit when the input can not be converted to a int. (That means hasNextInt() returns false.) Use the prompt given above. After exiting the loop, print "All done" (only in the draft)

7A draft:
7A final:

7B

Complete the TenCirclesViewer class to draw ten circles that have radius of 10, 20, ..., 100. They all touch the line x = 5 at the left and the line y = 10 at the top. (They are tangent to the lines) Draw the smallest circle first. You must use a loop in your solution.

Another way to look at this is that the circles are inside a right angle consisting of the lines x = 5 and y = 10. The circles are tangent to the sides of the right angle.

Here is an image with the tangent lines drawn in red.

10 circles

You will receive no credit for a final solution that draws ten separate circles even if it passes Codecheck.

For the draft: just draw the smallest circle. Leave the red lines. (You do not need to use a loop)


7B draft:
7B final:

7C

Write a class ImageAnalyzer to analyze a graphical image

An ImageAnalyzer has a constructor that takes a Picture object as a parameter.

It has these methods:

Enlargement of part of the hazy image

enlarged output

Download this image and put it in your project

oliver

Provide Javadoc

For the draft, provide the instance variable, the constructor and the first two methods along with Javadoc.

7C draft:
7C final: