# Plz Provide correct program code for all questions.

nitesh Sah
Plz Provide correct program code for all questions.
4 Answer(s)      6 years and 10 months ago
Posted in : Java Beginners
1. Write a program to find the difference between sum of the squares and the square of the sums of n numbers?

2. Develop a program that accepts the area of a square and will calculate its perimeter.

3. Develop the program calculateCylinderVolume., which accepts radius of a cylinder's base disk and its height and computes the volume of the cylinder.

4. Utopias tax accountants always use programs that compute income taxes even though the tax rate is a solid, never-changing 15%. Define the program calculateTax which determines the tax on the gross pay. Define calculateNetPay that determines the net pay of an employee from the number of hours worked. Assume an hourly rate of \$12.

5. An old-style movie theater has a simple profit program. Each customer pays \$5 per ticket. Every performance costs the theater \$20, plus \$.50 per attendee. Develop the program calculateTotalProfit that consumes the number of attendees (of a show) and calculates how much income the show earns.

6. Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder.

7. Develop the program calculatePipeArea. It computes the surface area of a pipe, which is an open cylinder. The program accpets three values: the pipes inner radius, its length, and the thickness of its wall.

8. Develop the program calculateHeight, which computes the height that a rocket reaches in a given amount of time. If the rocket accelerates at a constant rate g, it reaches a speed of g · t in t time units and a height of 1/2 * v * t where v is the speed at t.

9. Develop a program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time, and the Pythagorean Theorem is c2 = a2 + b2.

10. Develop a program that accepts an initial amount of money (called the principal), a simple annual interest rate, and a number of months will compute the balance at the end of that time. Assume that no additional deposits or withdrawals are made and that a month is 1/12 of a year. Total interest is the product of the principal, the annual interest rate expressed as a decimal, and the number of years.

Mail me at [email protected] as soon as possible. Thanks.

December 16, 2010 at 3:27 PM

Hi Friend,

Try the following code:

1)

```import java.util.*;
class FindDifference
{
public static void main(String[] args)
{
int sum=0,sum1=0,sum2=0;
Scanner input=new Scanner(System.in);
System.out.println("Enter value of n: ");
int n=input.nextInt();
for(int i=1;i<=n;i++){
int sq=i*i;
sum1+=sq;
}
//System.out.println(sum1);
for(int i=1;i<=n;i++){
sum+=i;
}
sum2=sum*sum;
//System.out.println(sum2);
int diff=0;
if(sum1>sum2){
diff=sum1-sum2;
}
else{
diff=sum2-sum1;
}
System.out.println(diff);

}
}
```

2)

```   import java.util.*;
import java.text.*;
class  PerimeterOfSquare{
public static void main(String[] args)
{
DecimalFormat df = new DecimalFormat("##.00");
Scanner input=new Scanner(System.in);
System.out.println("Enter Area of Square:");
double area=input.nextDouble();
double side=Math.sqrt(area);
System.out.println("Side of Square is: "+df.format(side));
double perimeter=4*side;
System.out.println("Perimeter of Square is: "+df.format(perimeter));

}
}

3)

import java.util.*;
import java.text.*;

class CalculateCyliderVolume
{
public static void main(String[] args)
{
DecimalFormat df = new DecimalFormat("##.00");
double PI=3.14;
Scanner input=new Scanner(System.in);
double r=input.nextDouble();

System.out.print("Enter Height: ");
double h=input.nextDouble();

double volume=PI*r*r*h;
System.out.println("Volume of Cylinder: "+df.format(volume));
}
}
```

December 16, 2010 at 4:12 PM

continue..

4)

```import java.util.*;
import java.text.*;
public class CalculateNetPay
{
public static void main(String[]args){
double taxRate=0.15;
double hourlyRate=12;
DecimalFormat df=new DecimalFormat("\$##.00");
Scanner input=new Scanner(System.in);
System.out.print("Enter Number of Hours Worked: ");
double hrs=input.nextDouble();
double gp=hrs*hourlyRate;
double tax=gp*taxRate;
double netpay=gp-tax;
System.out.println("Net Pay is: "+df.format(netpay));
}
}
```

5)

```import java.util.*;
import java.text.*;
class  CalculateTotalProfit{
public static void main(String[] args)
{
DecimalFormat df=new DecimalFormat("\$##.00");
double theaterCost=20;
Scanner input=new Scanner(System.in);
System.out.println("Enter Number of Customers: ");
double cus=input.nextDouble();
double earnFromTickets=5*cus;
double attendeesCost=cus*0.50;
double cost=attendeesCost+theaterCost;
double profit=earnFromTickets-cost;
System.out.println("Total Profit: "+df.format(profit));
}
}
```

6)

```import java.util.*;
import java.text.*;
class CalculateCylinderArea
{
public static void main(String[] args)
{
DecimalFormat df = new DecimalFormat("##.00");
double pi=3.14;
Scanner input=new Scanner(System.in);
double r=input.nextDouble();

System.out.print("Enter Height: ");
double h=input.nextDouble();

double v1=2*pi*r*r;
double v2=2*pi*r*h;

double surfaceArea=v1+v2;
System.out.println("Surface Area of Cylinder: "+df.format(surfaceArea));
}
}
```

Thanks

December 16, 2010 at 5:54 PM

Hi Friend,

Try the following code:

```import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class TotalInterest extends JFrame{
TotalInterest(){
JLabel lab1=new JLabel("Principal");
final JTextField text1=new JTextField(20);

JLabel lab2=new JLabel("Rate of Interest");
final JTextField text2= new JTextField(20);

JLabel lab3=new JLabel("Number of Months");
final JTextField text3=new JTextField(20);

JButton b=new JButton("Get");
public void actionPerformed(ActionEvent e){
double p=Double.parseDouble(text1.getText());
double r=Double.parseDouble(text2.getText())/100;
double t=Double.parseDouble(text3.getText())/12;

double interest=p*r*t;
JOptionPane.showMessageDialog(null, "Total Interest is: "+interest);
}
});
setLayout(null);
lab1.setBounds(10,10,100,20);
text1.setBounds(150,10,200,20);
lab2.setBounds(10,40,100,20);
text2.setBounds(150,40,200,20);
lab3.setBounds(10,70,120,20);
text3.setBounds(150,70,200,20);
b.setBounds(150,110,70,20);
setVisible(true);
setSize(400,200);
}
public static void main(String[] args){
new TotalInterest();
}
}
```

Thanks

December 16, 2010 at 6:53 PM

this is not fair... this is your 1st assignment of TCS and u r searching answeres here n there...this will not help u... it's very basic assignment and try urself... its not compulsory to submit assignment... if u'll not learn this u'll really face the big problems.

Now its ur choice what do u want... getting some help n searching for all solutions r 2 diff things... so study... dont waste ur time..

Plz Provide correct program code for all questions.
Plz Provide correct program code for all questions.   Write a program... of n numbers? Develop a program that accepts the area of a square and will calculate its perimeter. Develop the program calculateCylinderVolume., which accepts
Plz provide me all the material for Java
Plz provide me all the material for Java  Plz provide me all the material for Java   Please go through the following link: Java Tutorials
I didn't gat an output for this code, plz send me a correct code
I didn't gat an output for this code, plz send me a correct code  Hi, Here is my code: import java.awt.event.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.*; import java.sql.*; public
Please provide the java code for the given program.
Please provide the java code for the given program.   We need an application for managing an educational institute. That application should provide...: StudentAddr: StudentDob: Email: Course ALL Java C C++ Oracle Fees: Duration: Faculty
plz solve this program - Java Interview Questions
plz solve this program  write a program to out put this resault using two dimensional array this is an image of the reasult: http://www.4shared.com/file/154846107/dc2f1ac1/_2__Untitled-1.html so help me
very urgent : Iam unable to code this program plz help me - RMI
very urgent : Iam unable to code this program plz help me  Write a Multi-user chat server and client.  Hi friend, Chat server is a standlone application that is made up the combination of two-application, server
Please provide the code   Program to find depth of the file in a directory and list all files those are having more number of parent directories
plz Help me find the correct programs answers
plz Help me find the correct programs answers   Create a washing... and loading capacity. Display the updated truck details. Write a program which performs to raise a number to a power and returns the value. Provide a behavior
program code - Java Server Faces Questions
program code  hai i am meyis i need a jsp program code for date generation.(mssql-back end) Fields are fromdate and todate both field are datetime..., Plz explain the below code line with source code to solve the problem. "how
please correct this program  import java.util.Scanner; public class Nam { public static void main (String arg[]) { String[] name={"Aki","Karthi","Tk","Suba","Malu","Buvi","Janu","Sara","Sandy","Abi","Ani","Amu
Provide the code please   Program to calculate the sum of two big numbers (the numbers can contain more than 1000 digits). Don't use any library classes or methods (BigInteger etc
Plz give me code for this question
Plz give me code for this question  Program to find depth of the file in a directory and list all files those are having more number of parent directories
provide me the program for that ques.
provide me the program for that ques.  wtite a program in java there is a class readchar.the functionality of this class is to read a string from...;Hi Friend, You can try the following code: import java.util.*; class
Please provide the code   Write a program to recursively download the web pages available in the given site URL
plz send code for this
plz send code for this  Program to calculate the sum of two big numbers (the numbers can contain more than 1000 digits). Don't use any library classes or methods (BigInteger etc
what error in this program plese correct it
what error in this program plese correct it  import java.io.*; class y { public static void main (String args[]) { Data inputStream dis = new Data inputstream(System.in); float l,b,a; Systyem.out.println("enter the lengh"); l
please provide the code   Develop a multi-client chat application
Please provide the code   Create a file system: We just have one file on the hard disk. But we can create directories, sub-directories and files in that file only
provide code - Swing AWT
provide code  Dear frnds please provide code for two player CHESS GAME.....using swings,awt concepts   Hi friend, import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public
plz help me today plz plz - Java Interview Questions
plz help me today plz plz  2.) Suppose list is an array of six elements of type int. What is stored in list after the following java code executes....) What is the output of the following program? . public class exercise6
please provide code - Java Beginners
please provide code  provide code to snake game in J2SE
plz - Java Interview Questions
; Hi Friend, Try the following code: import java.util.*; class die
provide me code - Java Beginners
provide me code  can any body provide code for SNAKE XENZIA game in NOKIA mobile? please urgently
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
Is the logic correct to detect IE version..plz let me know
Is the logic correct to detect IE version..plz let me know  <html> <head> <script type="text/javascript"> function checkIEVersion() { var IE_Version; var IE_Engine; /*@cc_on @if( @_jscript_version
jsp code plz
jsp code plz  write jsp code which takes student roll number as input and prints the student group,study center, and his grade card   Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
plz help - Java Interview Questions
plz help  1)write a java program that prompts the user to input... on three exams and two large projects.the program should then add five decimal... don't use "for"  Hi Friend, Try the following code 1) import
help plz - Java Interview Questions
help plz  1 )write a program that does the following : a. prompts... 2)write a program that prompts the user to input a four-digit positive integer. the program than outputs the digits of the number, one digit per line
help plz - Java Interview Questions
help plz   1 )write a program that does the following : a. prompts... 2)write a program that prompts the user to input a four-digit positive integer. the program than outputs the digits of the number, one digit per line
code for program
code for program  hello,I am new to java and need to get the code for a program,i've been trying all sorts of code and nothing works any help would be appreciated.Below is what the program should output with the user's input