Write a program to produce the output using nested loops

Assignment Help JAVA Programming
Reference no: EM131565540

Problem 1

Create a complete Java program in a class named Bday that declares four variables and assigns appropriate values to them.
your birthday month (1-12)
your birthday day (1-31)
the birthday month of another student sitting near you today (1-12)
the birthday day of that same student near you (1-31)
Ask your neighbor for their name and for the proper numbers to store in the variables for his/her birthday. Then produce output in this format using your four variables:
My birthday is 9/19, and Suzy's is 6/14.

Problem 2 : Syntax errors(10)
The following program contains 9 mistakes! What are they? Copy and paste the following code into Jgrasp/Eclipse and correct the various mistakes.

public class Oops {
public static void main(String[] args) {
int x;
System.out.println("x is" x);

int x = 15.2; // set x to 15.2
System.out.println("x is now + x");

inty; // set y to 1 more than x
y = int x + 1;
System.out.println("x and y are " + x + and + y);
}
}

Problem 3:

Write a for loop that produces the song Bottles of Beer on the Wall:
10 bottles of beer on the wall, 10 bottles of beer
Take one down, pass it around, 9 bottles of beer on the wall

9 bottles of beer on the wall, 9 bottles of beer
Take one down, pass it around, 8 bottles of beer on the wall

... (output continues in the same pattern) ...

1 bottles of beer on the wall, 1 bottles of beer
Take one down, pass it around, 0 bottles of beer on the wall

Problem 4:
Write a complete Java program that produces this sequence of numbers using a for loop:
8
11
14
17
20
23

Problem 5: Printing a design

Write a program to produce the following output using nested for loops. Use a table to help you figure out the patterns of character on each line.

Test your loop expressions in Practice-1t! using the checkmark icon above. Use your expressions in the loop tests of the inner loops of your code.

Problem 6:

Consider the following method for convening milliseconds into days:

// converts milliseconds to days
public static double toDays (double millis) {

return millis / 1000.0 / 60.0 / 60.0 / 24.0;

Write a similar method named area that takes as a parameter the radius of a circle and that returns the area of the circle. For example. the call area (2.0 ) should return 12. 566370614359172. Recall that area can be computed as it times the radius squared and that Java has a constant called Math . PI.

Problem 7:

Write a method named pay that accepts two parameters: a real number for a TA's salary. and an integer for the number of hours the TA worked this week. The method should return how much money to pay the TA. For example. the call pay (5. 50, 6) should return 33.0.

The TA should receive *overtime pay of 1.1/2 normal salary for any hours above 8. For example. the call pay (4.00, 11) should return (4.00*8) + (6.00*3) or 50.0.

Reference no: EM131565540

Questions Cloud

Provide documentation to support meeting between git and fwa : Your task, in Paper 2, is to provide preparation documentation to support face-to-face meetings between GIT and the FWA.
Discuss about the development of policies : Data management is the development of policies, practices, and procedures in order to manage and maintain the needs of a corporation.
Design a flowchart or pseudocode : Design a flowchart or pseudocode - The Barking Lot is a dog day care center Creating a puesdocode for given example
Explain history of macroeconomics : Explain History of macroeconomics, Macroeconomics factor
Write a program to produce the output using nested loops : Write a program to produce the following output using nested for loops. Use a table to help you figure out the patterns of character on each line
What we understand by the term macroeconomics : explain in a paragraph what we understand by the term macroeconomics
Explain principles of effective interpersonal relationships : Explain principles of effective interpersonal relationships. Describe the principles of effective verbal and written communication.
What is market equilibration : What is Market Equilibration. What important role does it play in resource allocation in the markets
Find the area of the cross section of the culvert : The vertical cross section of a highway culvert is defined by the region within the ellipse 1.00x2 + 9.00y2 = 9.00, where dimensions are in meters.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd