Question:
java questions help!!!!!!!!!!!!!!!!!!!!!!!!!?
2011-03-14 00:50:48 UTC
i hav 2 submit 10 java programs tommorrow,please write the code for the below 10 problems as answers.person who writes all will get best answer.
Q1) A class result is created with the following details

Class name :result
Data Members
String name[] //to store name of 100 students
int roll[] //to store roll of 100 students
int tot[] //to store total marks(out of 500) for 100 students
Member functions
void getdata() // to store data for all 100 students
void formatdata() // to generate a merit list of all students. Name.rollno,marks of the child who has got max marks should be printed first,then the second highest scorer and so on.
void show() //to print merit list in tabular form as follows
NAME ROLLNO TOTAL MARKS

Q2) WAP to read a matrix and print its transpose . Also print sum of each row and each col of the matrix


Q3) A class replace is created with the following details

Class name replace
Data Members
String str,substr1
Member functions
replace()//constructor to assign null to str and substr
replace(String s)// constructor to assign s to str
void getword(String ss) //assign ss to substr1
int find_freq() // to find frequency of substr1 in str and return the frequecy

Q4) WAP to find SADDLE POINT in a matrix. A saddle point from any matrix is determined by finding smallest element in a row
which should be greatest in its corresponding column
Ex;
Input
No of rows = 3
No of cols = 4
Input Matrix
3 5 7 4
1 6 4 9
2 4 7 5
SADDLE POINT =3 present at ROW = 1 and COL = 1

Q5) Two different timings are added as
Time 1: 6 hours 35 minutes
Time 2: 3 hours 45 minutes
Sum of time - 10 hours 20 minutes
To find the solution of above question a class time is declared as follows
Class name :time
Data Members
hrs , min (integers) to store hrs and mts
void gettime(int nh,int nm) // to assign nh to hrs and nm to min
void printtime() // t display value of hrs,mins with suitable headings
time sumtime(time t1,time t2) // to add the timings given in the time objects t1,t2 and return them.

main() function to be written for all programs.

Create a class phone with the following specification

Class Name Phone
Data Members
char phoneno[8] //phone no should be 3 letters followed by 4 digits.
Member Functions
Void readdata( char *s) // to read the phone no
Void changeno() // to change the phone no
Void disp() // to display the phone no

The phone no is changed according to the following rules
The new phone no consists only of digits
The letters in the old system is converted in the new system according to the following rules

A,B,C -- > 2 D,E,F 3 G,H,I- 4 J,K,L 5 M,N 6 P,R,S7 ,T,U,V8
W,X,Y9 O,Q,Z0
Also every phone no in the new system must begin with 777

Your program should print the old phone no and the new phone no.

Write a program which reads 16 integers and stores them in a 2D array. The program should test to see whether the integer sum of all elements in each of the rows , in each of the columns ,and the two diagonals are identical. If the sum are all equal your program should output the string MAGIC SQUARE followed by the value of sum of elements of a row, otherwise your program should output the string ‘DULL SQUARE’ followed by the value of sum of elements in the diagonal going from top right to bottom left.

Example:
Input
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Output
DULL SQUARE 34

Create a class myarray with the following specifications
Class name myarray
Data members
int arr[50]
int size //to store actual no of elements in the array
Member functions
void getdata() //populate the array
void disp() // to print the array
myaray arrange(myarray) // to merge the arrays of 2 myarray objects in such way //that the even nos arrange themselves from left to right and the odd nos arrange themselves from right to left in the array of the merged object.
Your program should print the original arrays and the merged array.

4 Wap to produce the following design
* *
* *
* *
*
* *
* *
* *


5 Wap to read n number of elements in an integer array and do the following operations
Find the position of the largest and the smallest number
Find the second largest number
Find the index I such that the difference between the Ith and (I + 1)th element is maximum
Three answers:
vijay Karthik
2011-03-14 06:37:26 UTC
dude i guess u have wasted ur time for typing all that information because no one has that much time to write that many programs.
anup_agav
2011-03-14 10:41:52 UTC
5)

for(i=0;i<=n;i++)

{

for(j=0;j<=n;j++)

{

scanf(&a[i]);

}

}

for(i=0;i<=n;i++)

{

for(j=0;j<=n;j++)

{

if(a[i]>a[j])

{

temp=a[i];

a[i]=a[j];

a[j]=temp;

}

}

}

for(i=0;i<=n;i++)

{

if(i==0)

{

printf("Largest Number is :%d",a[i]);

}

else if(i==2)

{

printf("Second Largest Number is :%d",a[i]);

}

else if(i==n)

{

printf(" Smallest Number is :%d",a[i]);

}

}



4)

for(i=0;i<=7;i++)

{

if(i==3)

{

printf("*");

}

else

{

for(j=0;j<=2;j++)

{

printf("*");

}

}

}
Akhil
2011-03-14 08:28:08 UTC
lol

you expect someone to solve all that out for you

:P


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...