Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Every programming assignment is as much a test of English language comprehension

ID: 3608222 • Letter: E

Question

Every programming assignment is as much a test ofEnglish language comprehension as it is a test ofprogramming or mathematical skills. This week, the explanations of the formulae below are given clearly in plainEnglish if you read carefully. However, if there is anyquestion about what is being asked, you are urged to ask forclarification in the public forums.

Your program should compute and display the following values forthe n = 6, 9 and 16:

Be sure that your output is well organized andunderstandable. You might try organizing it in a tabular form(if you can; this is not required). I don't want to seeundocumented numbers on the screen.

This should all be done in one run of a single program, notseveral runs with n modified in the source each time.

Also, use the most straightforward means to compute. Inparticular, don't look for or use any "power" methods to computen-squared; that would be an inefficient approach. Instead, just multiply n by itself to compute n-squared.

Explanation / Answer

please rate - thanks import java.util.*; public class formulas { public static void main(String args[]) {int n,answer;    answer=1+2+3+4+5+6;    System.out.println("The sum of 1+2+3+...+n whenn=6 is: "+answer);    answer=1+2+3+4+5+6+7+8+9;    System.out.println("The sum of 1+2+3+...+n whenn=9 is: "+answer);    answer=1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16;    System.out.println("The sum of 1+2+3+...+n whenn=16 is: "+answer);    n=6;    answer=( n * (n + 1) ) / 2;    System.out.println("The value of ( n * (n + 1) )/ 2 with n= "+n+" is "+answer);    n=9;    answer=( n * (n + 1) ) / 2;    System.out.println("The value of ( n * (n + 1) )/ 2 with n= "+n+" is "+answer);    n=16;    answer=( n * (n + 1) ) / 2;    System.out.println("The value of ( n * (n + 1) )/ 2 with n= "+n+" is "+answer);    answer=3+5+7+9+11+13;    System.out.println("The sum of 3+5+...+(2n-1)when n=6 is: "+answer);    answer=3+5+7+9+11+13+15+17;    System.out.println("The sum of 3+5+...+(2n-1)when n=9 is: "+answer);    answer=3+5+7+9+11+13+15+17+18+19+20+21+22+23+24+25+26+27+28+29+30+31;    System.out.println("The sum of 3+5+...+(2n-1)when n=16 is: "+answer);    n=6;    answer=n*n-1;    System.out.println("The value of n squared -1with n= "+n+" is "+answer);    n=9;    answer=n*n-1;    System.out.println("The value of n squared-1 with n= "+n+" is "+answer);    n=16;    answer=n*n-1;    System.out.println("The value of n squared-1 with n= "+n+" is "+answer);    } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote