Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a Java class to find the difference between the sum of the cubes of the first one hundred natural numbers (1 to 100) and

Make a Java class to find the difference between the sum of the cubes of the first one hundred natural numbers (1 to 100) and the cube of the sum of the first 100 natural numbers. You may use either while or do while loop

 

For example:

The sum of the cubes of the first ten natural numbers is,

13+23+...+103 = 3025

The cube of the sum of the first ten natural numbers is,

(1+2+...+10)3=553 = 166375

Therefore the difference between the sum of the cubes of the first ten natural numbers and the cube of the sum is 166375385=163350

Your output must be formatted as follows: (The above example is used as a reference here)

The difference between the sum of the cubes from 1 to 10 and the the cube of the sum of numbers from 1 to 10 is 163350

Files to be submitted: java source. No test data needed for this question.


2. Make a Java class that calculates the sum of prime numbers between two numbers provided by the user at run time.

You must use nested for loops in your solution

Validate that the lower limit is lesser than the upper limit

Also validate that both lower and upper limits are positive numbers

You must display the sum.

Example:

Enter lower limit: 1

Enter upper limit: 10

Sum of primes: 17

Please include a test doc as per the instructions above for this class. Three test cases needed. Each test case must list all the inputs provided and the output must show the result obtained.

Provide 3 test cases for this class


make a Java class that displays the following pattern:

1 2 3 4 5 6 7 8 9 10

The class must ask the user for the number of rows to be displayed. The example shown is for 4 rows.

Validate that the input value of rows is a positive number between 2 and 15 (both numbers inclusive)


Please also make sure you format the source code before uploading to Canvas.

Each Java class must be uploaded as a file with the .java extension.

On Windows its Ctrl + Shift + F and on macOS it is Cmd + Shift + F.

For the test cases, you can submit one word doc or pdf showing the test cases for each class you submit.

Each test case will show what you used as input and the output you obtained. Include a case where your logic produces an error.

Only test cases must be submitted using a word doc or a pdf (if you are using Google Docs) using the following format for each class

Class Name:

Input Output





Step by Step Solution

There are 3 Steps involved in it

Step: 1

Here are the Java classes for the given problems 1 Class to find the difference between the ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual C# An Introduction to Object-Oriented Programming

Authors: Joyce Farrell

7th edition

978-1337102100

More Books

Students also viewed these Operating System questions

Question

for the parent x^(2) and the, modified version -4(x-3)^(2)

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago

Question

What is job description ? State the uses of job description.

Answered: 1 week ago

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

5. How does one adjust for small expected frequencies?

Answered: 1 week ago