Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

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

Create a class to represent a Circle type in java, which should have following: 

• radius. Instance field of type double 

• Constructor. that accept an argument for radius 

• getRadius. public method that returns the radius of Circle 

• getArea. Method that returns the area of Circle 

 


Write a value-returning method, isVowel that returns the value true if a given character is a vowel, and otherwise returns false. In main () method accept a string from user and count number of vowels in that string. 


**Using a three dimensional array***



Sample:



Enter a number of tables: 2


Enter a number of rows: 2


Enter a number of columns: 2




Enter 8 number of elements:



1


2


3


4


5


6


7


8



The biggest number among them is: 8


The smallest number among them is: 1


Then second to the biggest number is: 7

2. Write an application that contains an array of 10 multiple-choice quiz questions related to


your favorite hobby. Each question contains three answer choices. Also create an array


that holds the correct answer to each question—A, B, or C. Display each question and


verify that the user enters only A, B, or C as the answer—if not, keep prompting the user


until a valid response is entered. If the user responds to a question correctly, display


Correct; otherwise, display the correct answer is and the letter of the correct answer. After


the user answers all the questions, display the number of correct and incorrect answers.


Save the file as Quiz.java.



Question 1: Student

 

Write the class definition for a Student class that contains four private data members: 

Ø An int studNum to store the student number.

Ø A string studFirstName to store the student’s first name.

Ø A string studSurname to store the student’s surname.

Ø A one dimensional array subjectCode of type string that hold the five subjects that the student is registered for.

Ø A parallel array to the subject code array called finalMark that holds the final mark that the student obtained for the subject stored in the subject code array.

Ø A double overallAverage that will hold the overall average that the student has obtained for all the subjects that he/she is registered for.


Question 1: Student



Write the class definition for a Student class that contains four private data members:


An int studNum to store the student number.


A string studFirstName to store the student’s first name.


A string studSurname to store the student’s surname.


A one dimensional array subjectCode of type string that hold the five subjects that the student is registered for.


A parallel array to the subject code array called finalMark that holds the final mark that the student obtained for the subject stored in the subject code array.


A double overallAverage that will hold the overall average that the student has obtained for all the subjects that he/she is registered for.




Create a program that allows the user to enter 10 integers in an array. Your task is to determine

if the user entered a negative number. If yes, display the negative numbers.


Create a program that allows the user to enter 10 integers in an array. Then ask the user to input an integer. Your task is to determine if the integer is found in the list/array.


Enter an integer to search in the array: 2

2 is found in the array


Enter a string to search in the array: bedazzled

bedazzled is found in the array




Write a program that has these overloaded search methods to do array searching:


boolean search(int[] arr, int searchKey) – searches an integer array given a search key value, returns true if searchKey is found, false if not.


Hint:

boolean found=false;

for(int i=0; i<arr.length; i++){

   if(    ){//compare the array element with the search key value

      //action taken if found

   }

}

//return something


boolean search(String[] arr, String searchKey) – searches an array of strings given a search key value, returns true if searchKey is found, false if not.

(read Comparing_Strings.doc)


In the main method, you can declare and initialize the two arrays with random values, for example:

int[] intArray={7,3,2,8,1,0,9};

String strArray={"Enchanted","Bedazzled","Divine","Delighted","Elegant"};


Use the methods in the program.




LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS