Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

Java, Programming

  • Category:- Java
  • Reference No.:- M92374257
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Java

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As