© Ron Dai 2019
R. DaiLearn Java with Mathhttps://doi.org/10.1007/978-1-4842-5209-3_13

13. Java Basics Projects

Ron Dai1 
(1)
Seattle, WA, USA
 
  1. A.

    Write code to print out the following graph.

     
../images/485723_1_En_13_Chapter/485723_1_En_13_Figa_HTML.jpg
  1. B.

    Write code to draw the following shape.

     
../images/485723_1_En_13_Chapter/485723_1_En_13_Figb_HTML.jpg
  1. C.

    Write code to make this triangle.

     
../images/485723_1_En_13_Chapter/485723_1_En_13_Figc_HTML.jpg
  1. D.

    Write a function to check if an integer is divisible by another integer.

    For example:

    (1) Given input 10, 5, output is “yes, 2”;

    (2) Given input 11, 2, output is “no”;

     
  2. E.

    Write Java code to draw the Christmas tree.

     
../images/485723_1_En_13_Chapter/485723_1_En_13_Figd_HTML.jpg
  1. F.

    Write code to find all factors for a given positive integer.

    For example, when a user inputs “10,” your program should output 1, 2, 5, 10

     
  2. G.

    Write a method that accepts a month (i.e., an integer between 1 and 12) as a parameter and returns the number of days in that month in the current year.

     
  3. H.

    Write code to produce a product of two numbers that are inputs from the console:

    Please enter two numbers for multiplication

    Next number --> 7

    Next number --> 15

    Product = 105

     
  4. I.

    Write a method to examine whether a positive integer is a prime number or not.

     
  5. J.

    Write a method to convert an integer number to a string of that number's representation in binary. For example, given a parameter “19,” it should return “10011”.

     
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.39.74