Corrected Question
Write a program that reads in 15 numbers in sorted order from the user (i.e. the user enters them in order) and stores them in a 1D array of size 15. Next, prompt the user for a number to search for in the array (i.e. the "target"). Then, print the array. Next, search the array using a linear search – find the target element and printing out the target and its index as well as the entire array
Answer:
The solution is given in the explanation section
See detailed explanation of each step given as comments
Explanation:
import java.util.*;
class Main {
public static void main(String[] args) {
//Create the array of 15 elements
int [] array = new int [15];
//Create an object of the scanner class to receive user input
Scanner in = new Scanner(System.in);
//Prompt user to enter the values in sorted order
//Using a for loop
for (int i =0; i<array.length; i++){
System.out.println("Enter the next element: In SORTED order please!");
array[i] = in.nextInt();
}
System.out.println("All Fifteen element have been entered");
// Ask the user for an element to be searched for
//A target element
System.out.println("Which element do you want to search for in the array");
//Create the target element
int target = in.nextInt();
//Use a for loop to sequentially check each element in the array
for(int i = 0; i<array.length; i++){
if(array[i]==target){
System.out.println(target+" is found at index "+i +" of the array");
}
}
// Printout the entire array
System.out.println(Arrays.toString(array));
}
}
(1) Prompt the user to enter a string of their choosing. Output the string.
Ex: Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself.
(2) Complete the GetNumOfCharacters() function, which returns the number of characters in the user's string. Use a for loop in this function for practice. (2 pts)
(3) In main(), call the GetNumOfCharacters() function and then output the returned result. (1 pt) (4) Implement the OutputWithoutWhitespace() function. OutputWithoutWhitespace() outputs the string's characters except for whitespace (spaces, tabs). Note: A tab is '\t'. Call the OutputWithoutWhitespace() function in main(). (2 pts)
Ex: Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself. Number of characters: 46 String with no whitespace: The only thing we have to fear is fear itself.
Answer:
See solution below
See comments for explanations
Explanation:
import java.util.*;
class Main {
public static void main(String[] args) {
//PrompT the User to enter a String
System.out.println("Enter a sentence or phrase: ");
//Receiving the string entered with the Scanner Object
Scanner input = new Scanner (System.in);
String string_input = input.nextLine();
//Print out string entered by user
System.out.println("You entered: "+string_input);
//Call the first method (GetNumOfCharacters)
System.out.println("Number of characters: "+ GetNumOfCharacters(string_input));
//Call the second method (OutputWithoutWhitespace)
System.out.println("String with no whitespace: "+OutputWithoutWhitespace(string_input));
}
//Create the method GetNumOfCharacters
public static int GetNumOfCharacters (String word) {
//Variable to hold number of characters
int noOfCharactersCount = 0;
//Use a for loop to iterate the entire string
for(int i = 0; i< word.length(); i++){
//Increase th number of characters each time
noOfCharactersCount++;
}
return noOfCharactersCount;
}
//Creating the OutputWithoutWhitespace() method
//This method will remove all tabs and spaces from the original string
public static String OutputWithoutWhitespace(String word){
//Use the replaceAll all method of strings to replace all whitespaces
String stringWithoutWhiteSpace = word.replaceAll(" ","");
return stringWithoutWhiteSpace;
}
}
On what date was jschlatt originally added to the dreamsmp server, and on which date was his second appearance on the server?
since this has already been answered, who is your favorite SMP character?
mines Wilbur/ Ghostbur
some people will disagree with me but jshlatt is one of my favorite characters on the dream smp . But my all time favorite characters is ALL of Wilbur's characters
What are two examples of items in Outlook?
a task and a calendar entry
an e-mail message and an e-mail address
an e-mail address and a button
a button and a tool bar
Answer:
a task and a calendar entry
Explanation:
ITS RIGHT
Answer:
its A) a task and a calendar entry
Explanation:
correct on e2020
What is his resolution amount
the language is Java! please help
public class Drive {
int miles;
int gas;
String carType;
public String getGas(){
return Integer.toBinaryString(gas);
}
public Drive(String driveCarType){
carType = driveCarType;
}
public static void main(String [] args){
System.out.println("Hello World!");
}
}
I'm pretty new to Java myself, but I think this is what you wanted. I hope this helps!
Write code that prints: Ready! numVal ... 2 1 Start! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: numVal
Answer:
Written in Python
numVal = int(input("Input: "))
for i in range(numVal,0,-1):
print(i)
print("Ready!")
Explanation:
This line prompts user for numVal
numVal = int(input("Input: "))
This line iterates from numVal to 1
for i in range(numVal,0,-1):
This line prints digits in descending order
print(i)
This line prints the string "Ready!"
print("Ready!")
B1:B4 is a search table or a lookup value
Answer:
lookup value
Explanation:
What is the maximum number of VLANs that can be configured on a switch supporting the 802.1Q protocol? Why?
Answer:
4096 VLANs
Explanation:
A VLAN (virtual LAN) is a group of devices on one or more LAN connected to each other without physical connections. VLANs help reduce collisions.
An 802.1Q Ethernet frame header has VLAN ID of 12 bit VLAN field. Hence the maximum number of possible VLAN ID is 4096 (2¹²). This means that a switch supporting the 802.1Q protocol can have a maximum of 4096 VLANs
A lot of VLANs ID are supported by a switch. The maximum number of VLANs that can be configured on a switch supporting the 802.1Q protocol is 4,094 VLANS.
All the VLAN needs an ID that is given by the VID field as stated in the IEEE 802.1Q specification. The VID field is known to be of 12 bits giving a total of 4,096 combinations.But that of 0x000 and 0xFFF are set apart. This therefore makes or leaves it as 4,094 possible VLANS limits. Under IEEE 802.1Q, the maximum number of VLANs that is found on an Ethernet network is 4,094.
Learn more about VLANs from
https://brainly.com/question/25867685
Write a program that reads in 10 numbers from the user and stores them in a 1D array of size 10. Then, write BubbleSort to sort that array – continuously pushing the largest elements to the right side
Answer:
The solution is provided in the explanation section.
Detailed explanation is provided using comments within the code
Explanation:
import java.util.*;
public class Main {
//The Bubble sort method
public static void bb_Sort(int[] arr) {
int n = 10; //Length of array
int temp = 0; // create a temporal variable
for(int i=0; i < n; i++){
for(int j=1; j < (n-i); j++){
if(arr[j-1] > arr[j]){
// The bubble sort algorithm swaps elements
temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
}
}
}
public static void main(String[] args) {
//declaring the array of integers
int [] array = new int[10];
//Prompt user to add elements into the array
Scanner in = new Scanner(System.in);
//Use for loop to receive all 10 elements
for(int i = 0; i<array.length; i++){
System.out.println("Enter the next array Element");
array[i] = in.nextInt();
}
//Print the array elements before bubble sort
System.out.println("The Array before bubble sort");
System.out.println(Arrays.toString(array));
//Call bubble sort method
bb_Sort(array);
System.out.println("Array After Bubble Sort");
System.out.println(Arrays.toString(array));
}
}
5-5. Design an Ethernet network to connect a single client P C to a single server. Both the client and the server will connect to their workgroup switches via U T P. The two devices are 900 meters apart. They need to communicate at 800 M b p s. Your design will specify the locations of any switches and the transmission link between the switches.
5-6. Add to your design in the previous question. Add another client next to the first client. Both connect to the same switch. This second client will also communicate with the server and will also need 800 M b p s in transmission speed. Again, your design will specify the locations of switches and the transmission link between the switches.
Answer:
ok so u have take the 5 and put 6
Explanation:
5-5. Ethernet network design: UTP connections from client PC and server to workgroup switches, 900m fiber optic link between switches, 800 Mbps communication.
5-6. Additional client connects to the same switch, UTP connection, maintains existing fiber optic link, 800 Mbps communication with the server.
What is the explanation for this?5-5. For connecting a single client PC to a single server, both located 900 meters apart and requiring communication at 800 Mbps, the following Ethernet network design can be implemented:
- Client PC and server connect to their respective workgroup switches via UTP.
- Use fiber optic cables for the 900-meter transmission link between the switches.
- Install switches at the client PC and server locations.
- Ensure that the switches support at least 1 Gbps Ethernet speeds to accommodate the required transmission speed.
5-6. In addition to the previous design, for adding another client next to the first client:
- Connect both clients to the same switch.
- Use UTP cables to connect the second client to the switch.
- Ensure the switch supports 1 Gbps Ethernet speeds.
- Maintain the existing fiber optic transmission link between the switches.
- The second client can also communicate with the server at the required 800 Mbps transmission speed.
Learn more about Network Design at:
https://brainly.com/question/7181203
#SPJ2