Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.

Get a Professional Answer

Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.

100% Satisfaction Guarantee

Rate the answer you receive.

Ask ATLProg Your Own Question

ATLProg, Software Engineer

Category: Homework

Satisfied Customers: 8958

Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML

44910485

Type Your Homework Question Here...

ATLProg is online now

A. Write a Java program that:
Asks for an integer value n;
Then

Customer Question

A. Write a Java program that: Asks for an integer value n; Then asks for n number(s) from the user; Finally displays the average of all the numbers typed in by the user.

B (5 points) Write a program segment in Java that sets the value of “int Number1” randomly from the following set: {2, 4, 6, 10}.

C (5 points) Write a method Power(base, exponent) that returns the value of

base ^exponent;

(Assume that exponent is a positive, non-zero double and base is a double.)

2. (A) A program sorts an array’s elements into descending order. The array contains 5 elements. How many steps would sorting take (at most)? (B) Write a program that rolls a FOUR-sided die 20 times and stores results in int a[20]. (C) What does the following program print? Why? Explain with your own words.

public class Program { public static void main (String [] args) { final int arraySize =5; int a[] = { 1, 2, 3, 4, 5 }; int result = whatIsThis(a, arraySize); System.out.printf("Result is : %d.\n", result); } public static int whatIsThis(int b[], int size) { if ( size == 1 ) return b[ 0 ]; else return 2 * (b[ size - 1 ] ) + whatIsThis(b, size - 1 ); } }

3. (A) (Complex Numbers) Create a class called Complex for performing arithmetic with complex numbers. Complex numbers have the form

realPart + imaginaryPart * i

where i is square root of -1

Write a program to test your class. Use floating-point variables to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. Provide a no-argument constructor with default values in case no initializers are provided. Provide public methods that perform the following operations:

a) Add two Complex numbers: the real parts are added together and the imaginary parts are added together. Hint: For this exercise, please consider the use of this reference. A template looks like:

// Add two Complex numbers public Complex add( Complex Right ) { /* Write code here */ } b) Subtract two Complex numbers: the real part of the right operand is subtracted from the real part of the left operand, and the imaginary part of the right operand is subtracted from the imaginary part of the left operand. c) Print Complex numbers in the form (a, b), where a is the real part and b is the imaginary part.

(B) Write a program that inputs five numbers, each of which is between 10 and 100, inclusive. As each number is XXXXX display it only if it is not a duplicate of a number already read.

4. (A) Create a class of Circles with attribute radius that defaults to 1. (It must be positive for every circle.) Provide member methods that calculate the perimeter and the area of the circle. Also, provide set and get methods for the radius attribute. (Hint: perimeter = 2*radius*pi; and area = radius*radius*pi; pi is a constant, can be set to 3.14 here.)

5. Write a program that creates a queue of integers. After that it loads in 20 random integers between 1 and 6, and after the 20th number it prints out the content of the queue. Finally, the program calculates and prints out the average of the values without losing the values from the queue!

6. Create a class of Circle with attributes radius, X and Y that represent the Cartesian coordinates of the center point. Radius default value is 1, it must be positive for every circle. Provide a member method Cross that returns true if two circles cross each other. Otherwise it returns false. Cross has a Circle object input parameter.

I need it by tomorrow. I see that you have completed similar homework for someone else this week. The only difference I see is in problem 1B the set of numbers are {2, 4, 6, 10}. And in problem 2A a four sided die 20 times / int a[20]

I can send the answers to you, current price of question is incorrect... I have sent a Underpriced report on this to your registered email id, please confirm if the price looks ok to you. Please let me know so I can start working on this accordingly.

1: Write a Java program that: Asks for an integer value n; Then asks for n number(s) from the user; Finally displays the average of all the numbers typed in by the user.

2: Write a program segment in Java that sets the value of “int Number1” randomly from the following set: {2, 4, 6, 10}.

3: What does the following program print? Why? Explain with your own words.

public class Program { public static void main (String [] args) { final int arraySize =5; int a[] = { 1, 2, 3, 4, 5 }; int result = whatIsThis(a, arraySize); System.out.printf("Result is : %d.\n", result); } public static int whatIsThis(int b[], int size) { if ( size == 1 ) return b[ 0 ]; else return 2 * (b[ size - 1 ] ) + whatIsThis(b, size - 1 ); } }

4. Create a class of Circle with attributes radius, X and Y that represent the Cartesian coordinates of the center point. Radius default value is 1, it must be positive for every circle. Provide a member method Cross that returns true if two circles cross each other. Otherwise it returns false. Cross has a Circle object input parameter.

Are we all good ? I hope I’ve provided the information you were seeking. If you are happy with my service, please provide a rating. If not, please let me know so l can continue to help you. Thank you.

the circle problem does not compile and execute when I try to run it.

Create a class of Circle with attributes radius, X and Y that represent the Cartesian coordinates of the center point. Radius default value is 1, it must be positive for every circle. Provide a member method Cross that returns true if two circles cross each other. Otherwise it returns false. Cross has a Circle object input parameter.

We are using recursion to achieve the result whatIsThis method I called inside whatIsThis method with return condition of size = 1. When we get to size ==1 we return b[0] which is 1

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.

JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.

Web sites like justanswer.com/legal ...leave nothing to chance.

Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.

Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.

I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C.Freshfield, Liverpool, UK

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. RobinElkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.DianeDallas, TX