Define and initialize five arrays of integer types each having 6 elements and an array of pointers p of size 5. Store the starting address of each array to an array of pointers p. Design and call the function and initialize the values of these five arrays randomly using for loop and p inside this function. we can consider p as a 2D matrix. However, in that case, our number of rows (Which were 5 as there were 5 arrays stored in p) and the number of columns (which were 6 as each array had 6 elements) were fixed. In this question, your goal is to sort all data in the 2d array.
Write a program to demonstrate the use of pointer to pointer. Make a list of characters (a word) by char *word, another list of words (a sentence) using char **sentence. Print the sentence using a double pointer.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter a String");
String line = in.nextLine();
while (true) {
int space = line.indexOf(' ');
String word = line.substring(0, space == -1 ? line.length() : space);
System.out.println(word + " " + word.length() + " " + (word.length() > 1 ? word.substring(word.length() - 1)
+ word.substring(1, word.length() - 1) + word.substring(0, 1) : word));
line = line.substring(space + 1);
if (space == -1) {
break;
}
}
}
}
Do the coding so that output will remain same but ternary operator will not be used.
Write a program to take a String as input then display the words in one column, its length in another column, replace the first with last character of each word in third column.
Enter a String
a is the first vowel
a 1 a
is 2 si
the 3 eht
first 5 tirsf
vowel 5 lowev
Hint: Use length(), indexOf(), substring() if required.
Array & split & ternary(? :) are not to be used
Create a min-heap . write function to insert a new number in min-heap . write function to delete its minimum element . write function to delete a given element from min-heap . write function to sort it in descending order .
Write the Java code required to solve the following problem. A complete program is
required and must follow all programming conventions (indenting, variable names,
comments, etc...).
You are to create a program which will place 8 queens on a chess board.
1 - Create a blank chessboard (8x 8 2D array of integers, all O's)
2 - Using a loop, ask the user for 8 locations on the board, replace the O with a 1 at
this location.
3 - Display the final board.
You do not need to include any error checking or checking for duplicate locations.
single digit numbers
create table guest (
guestfname varchar(50) not null,
guestlname varchar(50) not null,
guestphone number(10),
guestadd varchar,
guestID varchar(10) not null,
constraint pk_bill primary key (guestphone),
references room (guestID)
);
When I run it says missing left parenthesis Why??
Write a loop that inputs words until the user enters STOP. After each input, the program should number each entry and print in this format:
Write a program named SortWords that includes a method named SortAndDisplayWords that accepts any number of words from the user, sorts them in alphabetical order, and displays the sorted words separated by spaces. Test using two, five, or ten words.