Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Additional Engineering Textbook Solutions
Database Concepts (8th Edition)
Starting Out with Python (4th Edition)
Software Engineering (10th Edition)
Starting Out with C++: Early Objects (9th Edition)
Starting Out With Visual Basic (7th Edition)
Concepts of Programming Languages (11th Edition)
- Write a program that first reads an integer for the array size, then reads characters into the array, and displays the consonants (i.e., a character is displayed only if it a consonant).arrow_forwardCreate a program that asks the user to type in 10 words one by one. The program should store each word in an array. The program should then go through the array of words one by one and it should upper case all the odd index words, and lowercase all the even index words. (Consider zero is even). Then the program should go through the array and print off the entire "sentence" word by word onto a single line, adding a period to the end. Then print off the list as an array using the Arrays.toString() command A sample output might look like. Please type in word #1 : Alpha Please type in word #2 : bravo Please type in word #3 : charlie Please type in word #4 : delta Please type in word #5 : echo Please type in word #6 : foxtrot Please type in word #7 : golf Please type in word #8 : hotel Please type in word #9 : india Please type in word #10 : juliet Your sentence is: alpha BRAVO charlie DELTA echo FOXTROT golf HOTEL india JULIET. As a string it would look like: [alpha,BRAVO, charlie, DELTA,…arrow_forwardWrite a program, which creates an array of 15 elements of type integer and initializes each of the elements with a value equals to the index of the element multiplied by 3. Print the elements of the array.arrow_forward
- JAVA Write a program that stores the weekly (Monday thru Sunday) daily temperatures for four weeks. Your program should allow the user to enter the temperatures and print a report with headings, the temperature for each day (your two-dimensional array), the calculated weekly average temperature for each of the four weeks (rows) and the calculated average temperature for each of the days of the week (cols). In addition, create a single-dimensional array of Strings representing the days of the week (Monday-Sunday) using an initializer list. Your program output should look like the following: Input Screen Enter Monday Temperature for Week 1: 10.0 Enter Tuesday Temperature for Week 1: 20.0 Enter Wednesday Temperature for Week 1: 30.0 (etc.) Enter Monday Temperature for Week 2: 60.0 (etc.) Output Screen Weekly Temperature Report Mon Tue Wed Thurs Fri Sat Sun Average 1 10.0 20.0 30.0…arrow_forwardPROGRAM in JAVA Write a program that defines two arrays - one of strings and one of integers, both of size 10. Your program should then ask the user to enter the a string representing a persons name (just one name - their family name - not their given name as well), and an integer representing their age. It should continue to do this until either the user enters ‘done’ instead of a name, or until the array is full (that is, 10 pairs of names and ages have been entered). It should then print out the names and ages as well as the names of the youngest and oldest. Hints: One tricky (deliberately) part is making sure that once you’ve typed ‘done’ to finish entering names, your program does not then ask you for the age of the person with name ‘done’ - be careful about this. This is one of the few cases where, if you are careful, you can sensibly use a ‘break’ statement outside of a switch statement Stage 6: Assessed Task Redo Stage 5 above but replace the arrays with ArrayLists.arrow_forward2. Write a program that will load A with 15 random numbers (range : 1-50). Display elements of A in ascending order. Then get a number X. Compare X to each element of A, if array element is less than X, replace that element with X. On another line, display elements of A after replacing all elements less than X with X.arrow_forward
- A scientist has developed a mathematical model for a physical process, and he wants to check how good is model is. To evaluate the correctness of his model, he wants to test the results of his model under certain parameters and compare them with experimental results. Write a program that first reads the number of tests (testCount) as an int followed by the results of each test according to the model as a double array (test Model) and finally the results of each test according to experiments as a double array (testExperiment). Then, the program should calculate the error of the model by evaluating the average of the squares of the differences between the model result and experimental result (see formula below) using a function. Error Input 1 testCount NOTE: Individual square of the difference between the model value and the experiment value calculations MUST be done in the function. Every other functionality MUST be done in the main function. NOTE: To calculate square of a number you…arrow_forwardJAVAWrite a program that searches person's name and display all matched name. For example, if a user inputs the letter "Davis", the program searches all name which includes "Davis" in an array. Then, display all matched names on the screen. You must declare a single dimensional array which has all people’s name. Use methods of string classarrow_forwardQ3. Given an array of integers of an arbitrary number of elements, write a program that creates an array with the elements "rotated left" according to an integer denoting the shift. so [1, 2, 3] with shift 1 yields [2, 3, 1] and [1, 2, 3] with shift 2 yields [3, 1, 2].arrow_forward
- Write a program that creates a 2D array of size 4x5. Then, user enters the elements for this 2D array. Display the array in tabular form, using manipulators.arrow_forwardIn Java Write a program that counts the number of occurrences of lowercase and uppercase vowels inentered lines of text. Use a two-dimensional array to store the vowel counts. The array’s firstcolumn holds the counts for the lowercase vowels, and the second column holds the counts forthe uppercase vowels.The user indicates the end of the input by pressing enter by itself. At that point, your programshould print, for each vowel, the total number of lowercase occurrences, the total number ofuppercase occurrences, and the total number of combined occurrences.Here are some implementation requirements:1. Use two separate files – one for a main driver method and one for a VowelCounter classthat keeps track of vowel counts.2. main – Repeatedly prompt the user to enter a line of text or press enter by itself to quit.Note that the stdIn.nextLine() method returns the empty string ("") if the user pressesenter by itself. For each entered line of text, call the processLine method. When the…arrow_forwardWrite a program that creates a 2-D array initialized with test data . Use any primitive type of data EXCEPT int (Integer). The program should have all methods in the problem. getTotal - This method should accept a two-dimensional array as its argument and return the total of all the values in the array. getAverage - This method should accept a two-dimensional array as its argument and return the average of all the values in the array. getRowTotal. - This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the specified row. getColumnTotal - This method should accept a two-dimensional array as its First argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The method should return the total of the values in the specified column.…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education