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

  Can we run java byte code on android since android

Can we run java byte code on android since android is also java based

  Small computer system interface-standard computer disk

How many primary drive partitions are supported on computers that still conform to the standard established by MS-DOS? How many total partitions can a standard computer disk [Intergrated Drive Electronics (IDE)/Serial Advanced Technology Attachment (..

  Write a java program and pseudocode to read a number

Write a java program and pseudocode to read a number up to 15 digits long or a date (dd/mm/yyyy). The program should distinguish numbers from input date, and prints them in alphabetic spelling form

  Class pointparameters

What is the output of the following Java program? Explain in terms of how parameters are passed in Java.import java.awt.*;class PointParameters

  Create the classes war card deck listnode and queue

Create the classes War, Card, Deck, ListNode, Queue, LinkedQueue, and EmptyStructureException to play War. These classes can be found in the textbook.

  Implement a binary addition module in javascript

You are going to implement a binary addition module in Javascript (as part of the exam). This will be a Linked List (a Stack works well for this) implementation with two functions addBit() and print().

  Write your program to accommodate spaces and strings longer

Write your program to accommodate spaces and strings longer than 100 characters. You may also assume each line ends with a newline character.

  Update an existing java program using the netbeans ide

you will update an existing Java program using the NetBeans IDE. You will use the NetBeans Integrated Development Environment to make changes to an existing NetBeans Java Project. This existing program correctly sorts the data without using thread..

  Sample papaer hello can you please help me to solve this

hello can you please help me to solve this sample paper and there is not submit date as this is for me but still i want

  Descriptionyou are to write a program that determines the

descriptionyou are to write a program that determines the day of the week for new years day in the year 3000. to do

  Scenario - clinic management system

Change the category of a doctor - Clinic Management System - Java client application that perform

  Create the look for two gui applications

Create the look for two GUI applications. You WILL NOT be getting the applications to do anything. We are only interested in seeing how well you can arrange the GUI components onto the window

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