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.
A solution is prepared by mixing 1 g of ethanol (C2H6O) with 100 g water to give a final
volume of 101 ml. Calculate the mole fraction for the solute and solvent, and the molality of
ethanol in the solution.
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.
X and Y are substitute to one another what happen when price of a substitute increases, show its effects on the demand of the other goods.
What will happen to the demand curve of commodity X when price of a substitute increase.
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.
Q1. Show what will happen to the demand curve of commodity X when price of a substitute increases.
Q2. X and Y are substitute to one another what happen when price of a substitute increases, show its effects on the demand of the other goods.
Q3. If money income increases what will happen in the demand of the commodity X?
Q4. If money income decreases what will happen in the demand of the commodity X?
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.