Skip to content

Latest commit

 

History

History

Week1

WEEK1

Method that returns a String containing a series of Fibonacci numbers. The method takes one parameter: an integer of how many numbers (series length) to include.

Method called NestedLoop, which takes one String variable s and an integer variable upper_limit as its parameters. In the method, construct a nested loop structure, where the outer loop iterates the letters of the given String s. The inner loop iterates from 0 until upper limit (including the upper limit).

Method to determine the quadrant of a point (x,y) in a coordinate plane. The rules for figuring out the quadrant are as follows: • If both x and y are positive, the point belongs to quadrant 1. • If y is positive and x is negative, the point belongs to quadrant 2. • If both x and y are negative, the point belongs to quadrant 3. • If x is positive and y is negative, the point belongs to quadrant 4. • The origin (0,0) does not belong to any quadrant (quadrant 0). • If either x is 0 or y is 0, it means that the point is in between of quadrants (quadrant 0).

Java program that asks the user to enter a series of natural numbers (positive integers), calculate their sum, and print the sum out for the user. When the user enters a negative integer number or zero, the program stops and prints the sum.

Java method that calculates how many years, weeks and days can be formed from a given integer variable days. The method should take one integer variable as its parameter, and it should return a String variable.