Write an application that prints the following diamond shape. Don’t print any unneeded characters. (That is, don’t make any character string longer than it has to be.) (You may need to scroll to see everything.) * *** ***** ******* ********* ******* ***** *** *
Q: a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print…
A: I have provided a detailed code below.
Q: 1. What is right way to Initialize array? A. O int num[6] = { 2, 4, 12, 5, 45, 5 }; B. O int n{}…
A: As we know the basics of the programming. So, we can initialize an array in a number of different…
Q: Recover the hours and minutes; ex: 100 minutes after midnight is 1 hour and 40 minutes. In C++…
A: Task :- Fill in the code for some methods in given code.
Q: Implement one of the sorts described in Chapters 15 and 16. Input is an array with at least 10…
A: ALGORITHM:- 1. Take the input for the array of 10 elements which represent the number of visitors in…
Q: 3.27 LAB: Login name Write a program that creates a login name for a user, given the user's first…
A: The answer is given below.
Q: Subtract each element in origList with the corresponding value in offsetAmount. Print each…
A: The answr is given below:-
Q: int i, temp[10]; for (i = 0; i< 10; i++) temp[i] = 2*i; for (į = 0; į < 10; i++) cout << temp[) << "…
A: Given code: #include <iostream>using namespace std;int main(){ int i,temp[10]; for(i =…
Q: 2.1 Create a Java program that declares an array of type int and call it myRandomNumbers, with a…
A: Java Code: import java.util.Random;public class Main{ public static void main(String[] args) {…
Q: 35 } 36 public String toString() { return hour+" : "+minutes +" : "+seconds; } 37- 38 39 40 41 42-…
A: The Clock.java class is given below: public class Clock { private int hour; private int minutes;…
Q: Task 6 Implement the design of the Laptop class so that the following output is| produced [You are…
A: Note: - As per the guidelines we can only answer one specific question at a time. Please resubmit…
Q: C++ A robot is initially located at position (0; 0) in a grid [?5; 5] [?5; 5]. The robot can move…
A: The below given C++ program will obey the following rubrics: Including necessary header files.…
Q: int i = 0; i < a.ler [1] = a[(a[i] + 3)
A: Dear Student, Here array a contains 5 elements thus length of a is 5 and a.length is 5 , based on it…
Q: 3. The following code creates a 2D array of integers, and the nested for loops populate the array so…
A: The required Java program has been solved in the next step.
Q: Write an application that stores the following nine integers in an array called numbers: 10, 15, 19,…
A: store the given array in the variable of type integer array numbersnumbers[] ={10, 15, 19, 23, 26,…
Q: 1. Trace insertion sort on the following array of data. int A[] = { 19, 3, 78, 79, 15, 45, 1}; Pass…
A: 1. Trace insertion sort on the following array of data. int A[] = { 19, 3, 78, 79, 15, 45, 1}; The…
Q: Hi. I need help. I need this code to be rephrased or reworded so that it won't look like copied?…
A: The given code basically tells about how we can swap an array and then display array.Code consist of…
Q: Implement function WriteRectangle to display a (filled) rectangle on the screen, with the width and…
A: According to the information given:- We have to follow the instruction in order to get desired…
Q: int i, j; for(i=3, j=4 ; i>10; --i,j--) { } printf("%d and %d", i, j);
A:
Q: Consider a two-by-three integer array t. a) Write a statement that declares and creates t.b) How…
A: Note:- As per the given time slot we can solve only this much part of the question. So, please…
Q: 7. Which one should be executed so that the fifth element in Y to be FF if Y is an array of words?…
A: Correct answer of above given question is option (4) mov Y+8, FFh Explanation for correct answer is…
Q: Q3)Write a program to read an array of 5 numbers and finds the maximum one BY USIN CLASS.
A: The problem is based on finding the maximum value of an array.
Q: Q1) Write a program to read 10 temperatures in an array from the keyboard then compute and print the…
A: I have provided the answer based on C++ Programming. Detailed comments are included for a better…
Q: 11. What are the values of i and j obtained after the following code fraglHlen is run? int i = 15;…
A: Option 4: i=255 , j=0
Q: Write a program that creates an array of integers size 10. And do the following- a) Ask the user to…
A: Hi. As there is no programming language mentioned, I will attempt this question in C++. Let's…
Q: T/F 6) An array of int, double, or String may be sorted, but not an array of an Object type like a…
A: Please find the answer to the above question below:
Q: Write a Java statement to create an ArrayList called list to hold 25 integers. ArrayList list =…
A: Java program to create an array list of size 25 and initialize it with -1 is given below.
Q: the following: - Create an array of the following temperature readings: 36, 5, 10, 24, 40, 31 - use…
A: The program is written in java.Please find the program in the following step:
Q: I assume the following 2 codes express the same meaning? int myvar; int * myptr = &myvar; and…
A: True. Both statements are expressing the same meaning.
Q: 1. a) Fill in the blanks in the code below so that, when the code runs, its output is: 1) got null…
A: The programming methodology for the program is given by: For null pointer exception, declare string…
Q: JAVA. PLEASE ADD COMMENTS TO CODE ALSO INCLUDE TEST CASES IN THE FORM OF CODE AND NOT PROSE…
A: Introduction:- Below is the complete solution with explanation in detail. Below contains Java…
Q: Write a program in Java that reads 10 integers and store them in AN ArrayList. Then, do the…
A: Here I have first of all created an Arraylist with size 10. Now I have used a for loop to iterate 10…
Q: float someDataValues [] = new float[30]; for (int i = 1; i < someDataValues.length - 5; i+=4) {…
A: The output is964169324529
Q: Q5. a) Write a java program to demonstrate the use of mutable objects to find the Perimeter of a…
A: class Rectangle { // property of rectangle class int length,breadth; //Constructor…
Q: Assume int i[5] ={2,3,4,5,7}; Does the following statement work (yes/no)? cout << i…
A: A statement cout << i << endl; is meant to print the 5 numbers stored in the array i.…
Q: Consider a two-by-three integer array t. a) Write a statement that declares and creates t.b) How…
A:
Q: 6.19 LAB: Word frequencies - methods Define a method named getWordFrequency that takes an array of…
A: As language is not given doing it in Java Programming
Q: 9.4 (Duplicate Word Removal) Write a console app that inputs a sentence from the user (assume no…
A: Program:- using System;using System.Linq;public class Program { public static void Main() {…
Q: 1) Create a array of Fahrenheit temperatures, as follows int fahr []=…
A: Program Instructions:Define the given array in code and calculate the size of the array.Use for loop…
Q: int dizi3[2][3][2] = { {{0, 1}, {2, 3}, {3, 4}}, {{5, 6}, {7, 8}, {9, 10}} }; printf("%d ",…
A: The problem is based on finding the value of the array element at a particular position.
Q: 1. write a method that receives a character array and returns the number of symbols in the array
A: Given: Goal: Write a method in c++ that takes character array and return number of characters.
Q: 21.7 LAB: Login name (Use python) Write a program that creates a login name for a user, given the…
A: name = input("Input: ") lst = name.split(" ") #lst[0] = first name, lst[1] = last name, lst[2] =…
Q: Analyze the below code and fill in the blanks to complete the code #include int main() { int…
A: We are given a C code and in this code we are simply printing elements of two arrays named…
Q: cs101: Lab #5 Using Classes and Objects Part II 1. Write a program that computes the area of each…
A: Given:
Q: in python “c” represents a crop and “w” represents a water source. Each water source hydrates the…
A: A required program is as follows, fieldgrid = [] print('Input the number of rows and column in crop…
Q: 1. Examine the following code segment. What will be printed?If there are any errors indicate the…
A: The given C++ code segment is: int a[8] ={16, 12, 10, 7, 15, 18, 17, 29}; int *ptr ; ptr = & a[…
Q: using java programming int a[] = {5,10,4,20,1,7}; 1- search for the smallest element in array 2-if…
A: In this program we have to write a Java Program in which from an given array We have to find the…
Q: 15. Let C be the set of all Circles in the world, and S be the set of all Squares in the world. Vx E…
A: In questions with many questions, we must answer first one
Q: [CLO-5] What is the value of the variable ss after the following code is executed? int x[ 7 ] =…
A: What is value of variables ss after the following code is executed???
1.9: Diamond
Write an application that prints the following diamond shape. Don’t
print any unneeded characters. (That is, don’t make any character
string longer than it has to be.) (You may need to scroll to see everything.)
*
***
*****
*******
*********
*******
*****
***
*
SAMPLE RUN #0: java Diamond
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- 6.29 LAB: Remove all even numbers from an array Use Java programming. Write the removeEvens() method, which receives an array of integers as a parameter and returns a new array of integers containing only the odd numbers from the original array. The main program outputs values of the returned array. Hint: If the original array has even numbers, then the new array will be smaller in length than the original array and should have no blank elements. Ex: If the array passed to the removeEvens() method is [1, 2, 3, 4, 5, 6, 7, 8, 9], then the method returns and the program output is: [1, 3, 5, 7, 9] Ex: If the array passed to the removeEvens() method is [1, 9, 3], then the method returns and the program output is: [1, 9, 3] import java.util.Arrays; public class LabProgram { public static int[] removeEvens(int [] nums) { /* Type your code here */} public static void main(String[] args) { int [] input = {1,2,3,4,5,6,7,8,9};int [] result = removeEvens(input); // Helper method…Hi. I need help. I need this code to be rephrased or reworded so that it won't look like copied? THIS IS THE CONTINUATION OF THE CODE FOR BELOW } for (int i = lastEnd + 1; i < source.length; i++, j++) { swapped[j] = source[i]; } } else { for (int i = 0; i < source.length; i++) { swapped[i] = source[i]; } } System.out.println("Source:"); displayArray(source, 0, source.length - 1); if (firstFound) { System.out.println("First word:"); displayArray(source, firstStart, firstEnd); System.out.println("Last word:"); displayArray(source, lastStart, lastEnd); } System.out.println("After swap:"); displayArray(swapped, 0, swapped.length - 1); } } }Write an application that stores the following nine integers in an array: 10, 15, 19, 23, 26, 29, 31, 34, 38. Display the integers from first to last, and then display the integers from last to first.
- 3.6.5: Printing array elements separated by commas. Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp = {90, 92, 94, 95}, print:90, 92, 94, 95 Your code's output should end with the last element, without a subsequent comma, space, or newline.int dizi3[2][3][2] = { {{0, 1}, {2, 3}, {3, 4}}, {{5, 6}, {7, 8}, {9, 10}} }; printf("%d ", *((int*)dizi3 + 6)); Explain the results by examining them.2. Identify and correct the errors in each of the following statements: a) if ( c !< 17 ); window.alert( "c is not less than 17" ); b) if ( c =< 17 ) window.alert( "c is equal to or less than 17" ); c) while ( c <= 5 ) { product *= c; ++c; d) if ( gender == 1 ) document.writeln( "Woman" ); else; document.writeln( "Man" ); e)var a = new Array( 20); for ( varj = 0; j = 30, ++i ){ a[ j ] = 0; }
- Q.2) Write Java program that named after your first name that will prompts the user (Scanner) to enter 5 letters (lower case), store it in an array and sort the letters in descending order (z…Z) which stored in the array and print it out.T/F 6) An array of int, double, or String may be sorted, but not an array of an Object type like a CD class.Consider a two-by-three integer array t. a) Write a statement that declares and creates t.b) How many rows does t have? c) How many columns does t have? d) How many elements does t have? e) Write access expressions for all the elements in row 1 of t. f) Write access expressions for all the elements in column 2 of t. g) Write a single statement that sets the element of t in row 0 and column 1 to zero. h) Write a series of statements that initializes each element of t to zero. Do not use a repetition statement. i) Write a nested for statement that initializes each element of t to zero.j) Write a nested for statement that inputs the values for the elements of t from the user. k) Write a series of statements that determines and displays the smallest value in t. l) Write a printf statement that displays the elements of the first row of t. Do not use repetition. m) Write a statement that totals the elements of the third column of t. Do not use repetition. n) Write a series of…
- 6.19 LAB: Word frequencies - methods Define a method named getWordFrequency that takes an array of strings, the size of the array, and a search word as parameters. Method getWordFrequency() then returns the number of occurrences of the search word in the array parameter (case insensitive). Then, write a main program that reads a list of words into an array, calls method getWordFrequency() repeatedly, and outputs the words in the arrays with their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain less than 20 words.JAVA. PLEASE ADD COMMENTS TO CODE ALSO INCLUDE TEST CASES IN THE FORM OF CODE AND NOT PROSE Below is how the filenames are represented ARRAY[] = [50, 11, 33, 21, 40, 50, 40, 40, 21] Below is the expected output after de-duplication ARRAY[] = [11, 21, 33, 40, 50] Notice the reduced size of the output array. Also, take a look again at the input array and be reminded that the input array is not sorted ! Further, please DO NOT use library functions to either sort and or perform the de-duplication operation. (1) Implement your solution in such a way that your solution uses Bubble Sort as a sorting routine which brings the sorting time complexity to O(nˆ2). After sorting, solve the de-duplication problem. De-duplication part of the solution in itself must adhere to O(n) time and O(1) space bounds. Example of cases to be tested for are like : What if the array input which is expected does not exist - that is , input is a null. How should your code handle such a situation ? Maybe…Add each element in origList with the corresponding value in offsetAmount. Print each sum followed by a comma (no spaces). Ex: If origList = {4, 5, 10, 12} and offsetAmount = {2, 4, 7, 3}, print: 6,9,17,15, #include <iostream>#include <string.h>using namespace std; int main() { const int NUM_VALS = 4; int origList[NUM_VALS]; int offsetAmount[NUM_VALS]; int i; cin >> origList[0]; cin >> origList[1]; cin >> origList[2]; cin >> origList[3]; cin >> offsetAmount[0]; cin >> offsetAmount[1]; cin >> offsetAmount[2]; cin >> offsetAmount[3]; /* Your code goes here */ cout << endl; return 0;}