Other Programming & Computer Science Answers

Questions: 537

Answers by our Experts: 537

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Declare a variable to store text values.

9. Write short notes on:

a) Electronic mail

b) voice over IP

c) HTTP

d) FTP


Machine Exercise # 1 : Arrays and Strings


Write a program that uses a 3 3 3 array and randomly place each integer from 1 to 9 into the


nine squares. The program calculates the magic number by adding all the numbers in the array


and then dividing the sum by 3. The 3 3 3 array is a magic square if the sum of each row, each


column, and each diagonal is equal to the magic number. Your program must contain at least


the following functions: a function to randomly fill the array with the numbers and a function to


determine if the array is a magic square. Run these functions for some large number of times,


say 1,000, 10,000, or 1,000,000, and see the number of times the array is a magic square.


NOTE : SUBMISSION IN CPP FORMAT

a) Write a simple program to store some Employee objects in an ArrayList. Then display all the details of the objects in the ArrayList. Use the JOptionPane class for output.

 

b) Use the JOptionPane class to display only the name and surname of employees whose surname starts with the letter ‘M’. (Ensure that you have at least 2 such employees in the list).

Advanced: modify this functionality so that the start letter is not hard-coded, but the user can specify any letter, using the JOptionPane class for input.

 

c) Remove all employees whose salary is less than or equal to R5000. Then, using the JOptionPane class, display all the details of the remaining objects in the list.

 

d) Try to sort the contents of the list in alphabetical order of surname. Then, using the JOptionPane class, display all the details of the objects in the list.

 

e) Try to sort the contents of the list in ascending order of salary. Then, using the JOptionPane class, display all the details of the objects in the list.


Using Loop Statement, create a program that will be able to display student information such as, last name, first name, middle name, address.



Sample output:



Enter number of student: 2



Enter Last name: Sinco


Enter First name: Eddiemar


Enter Middle name: Garcia


Enter Address: Cabugao




Student 1


Name: Eddiemar Garcia Sinco


Address: Cabugao




Enter Last name: Sinco


Enter First name: Kent


Enter Middle name: Tiongson


Enter Address: Cabugao



Student 2:


Name: Kent Tiongson Sinco


Address: Cabugao




Using Loop Statement, create a program that will be able to display student information such as, last name, first name, middle name, address.



Sample output:



Enter number of student: 2



Enter Last name: Sinco


Enter First name: Eddiemar


Enter Middle name: Garcia


Enter Address: Cabugao




Student 1


Name: Eddiemar Garcia Sinco


Address: Cabugao



Enter Last name: Sinco


Enter First name: Kent


Enter Middle name: Tiongson


Enter Address: Cabugao



Student 2:


Name: Kent Tiongson Sinco


Address: Cabugao



Write a program using for loop statement that will display a series of number in ascending and descending order and it will also display the odd and even numbers.




Note: Use scanner and for loop statement



Sample output:




Enter a number: 15




Number in ASCENDING orders


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15



Number in DESCENDING orders


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1



EVEN Number


2 4 6 8 10 12 14



ODD Number


1 3 5 7 9 11 13 15






Write a program using for loop statement that will display a series of number in ascending and descending order and it will also display the odd and even numbers.




Note: Use scanner and for loop statement




Sample output:





Enter a number: 15




Number in ASCENDING orders



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15





Number in DESCENDING orders



15 14 13 12 11 10 9 8 7 6 5 4 3 2 1





EVEN Number



2 4 6 8 10 12 14





ODD Number



1 3 5 7 9 11 13 15






Write a program using for loop statement that will display a series of number in ascending and descending order and it will also display the odd and even numbers.



Note: Use scanner and for loop statement



Sample output:




Enter a number: 15



Number in ASCENDING orders


1


2


3


4


5


6


7


8


9


10


11


12


13


14


15



Number in DESCENDING orders


15


14


13


12


11


10


9


8


7


6


5


4


3


2


1



EVEN Number


2


4


6


8


10


12


14



ODD Number


1


3


5


7


9


11


13


15



Write a program using for loop statement that will display a series of number in ascending and descending order and it will also display the odd and even numbers.



Note: Use scanner and for loop statement



Sample output:




Enter a number: 15



Number in ASCENDING orders


1


2


3


4


5


6


7


8


9


10


11


12


13


14


15



Number in DESCENDING orders


15


14


13


12


11


10


9


8


7


6


5


4


3


2


1



EVEN Number


2


4


6


8


10


12


14



ODD Number


1


3


5


7


9


11


13


15





LATEST TUTORIALS
APPROVED BY CLIENTS