Answer:
#include <iostream>
#iclude <iomanip>
#include <algorithm>
using namespace std;
int main(){
int num1, num2, num3,
int sum, maxDrop, minDrop = 0;
float avg;
string end = "\n";
cout << " Enter the leaf drop for September: ";
cin >> num1 >> endl = end;
cout << "Enter the leaf drop for October: ";
cin >> num2 >> endl = end;
cout << "Enter the leaf drop for November: ";
cin >> num3 >> endl = end;
int numbers[3] = {num1, num2, num3} ;
string month[3] = { "September", "October", "November"}
for ( int i =0; i < 3; i++) {
if (numbers[i] < 0) {
cout << "Error: all leaf counts must be at least zero\n";
cout << "End of Maple Marvels\n";
cout << "Welcome to Maple Marvels";
break;
} else if (number[i] >= 0 ) {
sum += number[i] ;
}
}
for (int i = 0; i < 3; i++){
cout << month[i] << " leaf drop: " << numbers[i] << endl = end;
}
cout << "Total drop: " << sum << endl = end;
cout << setprecision(3) << fixed;
cout << "Average drop: " << sum / 3<< endl = end;
maxDrop = max( num1, num2, num3);
minDrop = min(num1, num2, num3);
int n = sizeof(numbers)/sizeof(numbers[0]);
auto itr = find(number, number + n, maxDrop);
cout << "Highest drop: "<< month[ distance(numbers, itr) ] << endl = end;
auto itr1 = find(number, number + n, minDrop);
cout << "Lowest drop: " << month[ distance(numbers, itr1) ] << endl = end;
cout << "End of Maple Marvels";
Explanation:
The C++ source code above prompts for user input for three integer values of the leaf drop count through the September to November. The total drop, average, minimum and maximum leaf drop is calculated and printed out.
A ______________ is a way of taking a screenshot or a picture of your computer screen.
Answer:
prt scan+Windows logo
Convert the following C program to C++.
More instructions follow the code.
#include
#include
#define SIZE 5
int main(int argc, char *argv[]) {
int numerator = 25;
int denominator = 10;
int i = 0;
/*
You can assume the files opened correctly and the
correct number of of command-line arguments were
entered.
*/
FILE * inPut = fopen(argv[1], "r");
FILE * outPut = fopen(argv[2], "w");
float result = (float)numerator/denominator;
fprintf(outPut,"Result is %.2f\n", result);
float arr[SIZE];
for( ; i < SIZE; i++) {
fscanf(inPut, "%f", &arr[i]);
fprintf(outPut, "%7.4f\n", arr[i]);
}
return 0;
}
Notice this is uses command-line arguments. I have provided an input file called num.txt that will be used when running the program. The output file is called out.txt.
Make sure you are using C++ style file I/O (FILE pointers/fopen) as well as regular I/O including the C++ style output formatting (fscanf, fprintf, formatting). Also use the C++ method of casting. The lines above that are bold are the lines that you need to convert to C++. Don't forget to add the necessary C++ statements that precede the main() function.
Answer:
The program equivalent in C++ is:
#include <cstdio>
#include <cstdlib>
#define SIZE 5
using namespace std;
int main(int argc, char *argv[]) {
int numerator = 25;
int denominator = 10;
FILE * inPut = fopen(argv[1], "r");
FILE * outPut = fopen(argv[2], "w");
float result = (float)numerator/denominator;
fprintf(outPut,"Result is %.2f\n", result);
float arr[SIZE];
for(int i = 0; i < SIZE; i++) {
fscanf(inPut, "%f", &arr[i]);
fprintf(outPut, "%7.4f\n", arr[i]);
}
return 0;
}
Explanation:
See attachment for explanation.
Each line were numbered with equivalent line number in the C program
Write a program whose inputs are three integers, and whose output is the smallest of the three values. Use else-if selection and comparative operators such as '<=' or '>=' to evaluate the number that is the smallest value. If one or more values are the same and the lowest value your program should be able to report the lowest value correctly. Don't forget to first scanf in the users input.
Ex: If the input is: 7 15 3
the output is: 3
You should sketch out a simple flowchart to help you understand the conditions and the evaluations needed to determine what number is the correct answer. This type of tool can help determine flaws in a logical design.
Answer:
The Program written in C is as follows:
#include <stdio.h>
int main() {
int num1, num2, num3, smallest;
printf("Enter any three numbers: ");
scanf("%d", &num1); scanf("%d", &num2); scanf("%d", &num3);
if(num1 <= num2 && num1 <= num3) {
smallest = num1;
}
else if(num2 <= num1 && num2 <= num3) {
smallest = num2;
}
else {
smallest = num3;
}
printf("Smallest: ");
printf("%d", num3);
return 0;
}
Explanation:
This line declares necessary variables
int num1, num2, num3, smallest;
This line prompts user for input of three numbers
printf("Enter any three numbers: ");
This lines get input for the three numbers
scanf("%d", &num1); scanf("%d", &num2); scanf("%d", &num3);
The following if/else statements determine the smallest of num1, num2 and num3 and assigns to variable smallest, afterwards
if(num1 <= num2 && num1 <= num3) {
smallest = num1;
}
else if(num2 <= num1 && num2 <= num3) {
smallest = num2;
}
else {
smallest = num3;
}
The next two lines print the smallest value
printf("Smallest: ");
printf("%d", num3);
WILL GIVE BRAINLYIEST 3pts) Make a prediction about which material will be the best insulator and conductor of heat. Materials: aluminum, glass, fiber glass, air between glass, and brick:
a. I think the _____________ will conduct heat better.
b. I think the _____________ will insulate heat better.
Answer:
a. I think the Aluminum will conduct heat better.
b. I think the Fiberglass will insulate heat better.
Fiberglass is used to insulate most everyday items, so I can be sure that fiberglass can be the best insulator, as for aluminum it conducts heat like you wouldn't believe.
Note: Your answer doesn't have to be right, they just want you to make a prediction about your answer, that means it's alright to guess, also know I didn't guess I am just telling you that you didn't have to ask this question. <3
What kind of a bug is 404 page not found
Answer:A 404 error is often returned when pages have been moved or deleted. ... 404 errors should not be confused with DNS errors, which appear when the given URL refers to a server name that does not exist. A 404 error indicates that the server itself was found, but that the server was not able to retrieve the requested page.
Explanation: Hope this helps
Consider a Stop-and-Wait protocol. Assume constant delays for all transmissions and the same delay for packets sent and ACKs sent. Assume no errors occur during transmission.
(a) Suppose that the timeout value is set to 1/2 of what is required to receive an acknowledgement, from the time a packet is sent. Give the complete sequence of frame exchanges when the sender has 3 frames to send to the receiver.
(b) Suppose that the timeout value is sent to 2 times the round trip time. Give the sequence of frame exchanges when 3 frames are sent but the first frame is lost.
Explanation:
question a) answer:
At the moment when it sends the package, then it has a waiting time for the acknowledgement from the receiver, however, the time will be split in two when the frameset size becomes two, meaning that two packages have been sent together, causing the receiver to acknowledge only one package.
question b) answer:
The timeout is equal to two times.
In cases when the frame size is 3, the frame will be lost since the timeout turns to be 2 times. Because the sender has to wait for the acknowledgement, therefore it will send other of the parcels.
what is 9x9x9? pls help
Answer:
729. is answer...........
Answer:
729
Explanation:
Given four values representing counts of quarters, dimes, nickels and pennies, output the total amount as dollars and cents. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("Amount: $%.2f\n", dollars); Ex: If the input is: 4 3 2 1 where 4 is the number of quarters, 3 is the number of dimes, 2 is the number of nickels, and 1 is the number of pennies, the output is: Amount: $1.41 For simplicity, assume input is non-negative.
LAB ACTIVITY 2.32.1: LAB: Convert to dollars 0/10 LabProgram.java Load default template. 1 import java.util.Scanner; 2 3 public class LabProgram 4 public static void main(String[] args) { 5 Scanner scnr = new Scanner(System.in); 6 7 /* Type your code here. */|| 8 9) Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box Enter program input (optional) If your code requires input values, provide them here. Run program Input (from above) 1 LabProgram.java (Your program) Output (shown below) Program output displayed here
Answer:
The corrected program is:
import java.util.Scanner;
public class LabProgram{
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int qtr, dime, nickel, penny;
double dollars;
System.out.print("Quarters: ");
qtr =scnr.nextInt();
System.out.print("Dimes: ");
dime = scnr.nextInt();
System.out.print("Nickel: ");
nickel = scnr.nextInt();
System.out.print("Penny: ");
penny = scnr.nextInt();
dollars = qtr * 0.25 + dime * 0.1 + nickel * 0.05 + penny * 0.01;
System.out.printf("Amount: $%.2f\n", dollars);
System.out.print((dollars * 100)+" cents");
}
}
Explanation:
I've added the full program as an attachment where I used comments as explanation
You have been given two classes, a Main.java and a Coin.java. The coin class represents a coin. Any object made from it will have a 1) name, 2) weight and 3) value. As of now, the instance variables in Coin.java are all public, and the main function is calling these variables directly for the one coin made in it.
Required:
Your goal is to enforce information hiding principles in this tasl. Take Coin.java, make all instance variables private and create set/get functions for each instance variable. Then replace the direct references in main() to each instance variable with a call to an appropriate set or get function.
Answer:
Here is the Coin class:
public class Coin { //class names
private int value; // private member variable of type int of class Coin to store the value
private String coinName; // private member variable of type String of class Coin to store the coint name
private double weight; //private member variable of type double of class Coin to store the weight
public void setValue (int v) { //mutator method to set the value field
value = v; }
public void setName(String n){ //mutator method to set coinName field
coinName = n;}
public void setWeight (double w) { //mutator method to set weight field
weight = w; }
public int getValue () { //accessor method to get the value
return value; } // returns the current value
public String getName () { //accessor method to get the coin name
return coinName; } //returns the current coin name
public double getWeight () { //accessor method to get the weight
return weight; } } //returns the current weight
Explanation:
Here is the Main.java
public class Main{ //class name
public static void main(String[] args) { //start of main method
Coin penny = new Coin(); //creates object of Coin class called penny
penny.setName("Penny"); //calls setName method of Coin using object penny to set the coinName to Penny
penny.setValue(1); //calls setValue method of Coin using object penny to set the coin value to 1
penny.setWeight(0.003); //calls setWeight method of Coin using object penny to set the coin weight to 0.003
System.out.println("Coin name: " + penny.getName()); // calls getName method of Coin using penny object to get the current coin name stored in coinName field
System.out.println("Coin value: " + penny.getValue()); // calls getValue method of Coin using penny object to get the coin value stored in value field
System.out.println("Coin weight: " +penny.getWeight()); }} // calls getWeight method of Coin using penny object to get the coin weight stored in weight field
The value of coinName is set to Penny, that of value is set to 1 and that of weight is set to 0.003 using mutator method and then the accessor methods to access these values and prinln() to display these accessed values on output screen. Hence the output of the entire program is:
Coin name: Penny Coin value: 1 Coin weight: 0.003
The screenshot of the program along with its output is attached.
How has the rise of mobile development and devices impacted the IT industry, IT professionals, and software development
Answer:
Throughout the interpretation section elsewhere here, the explanation of the problem is summarized.
Explanation:
The growth of smartphone production and smartphone apps and services, as well as the production of smartphones, has had a positive influence on the IT industry, IT practitioners, as well as the development of the technology. As normal, the primary focus is on smartphone apps instead of just desktop software. As we recognize, with innovative features, phone applications, and smartphones are all made, built, modernized every day, and always incorporated with either the latest technology.This has now resulted in far more jobs and employment for the IT sector, and therefore new clients for service-based businesses. It provided various-skilling the application production industry for IT experts including learning how to work on emerging technology. The demand for software production and software growth is evolving at a greater speed than it's ever been, so the increase of smartphone production and smartphones has had a very beneficial effect on perhaps the IT sector, IT practitioners, and business development.Which of the following behaviors is considered ethical?
copying another user’s password without permission
hacking software to test and improve its efficiency
using a limited access public computer to watch movies
deleting other user’s files from a public computer
Answer:
using a limited access public computer to watch movies
Explanation:
Cause it doesn't involve you performing any illegal actions.
Answer:
C. using a limited access public computer to watch movies
Explanation:
IM A DIFFERENT BREEED!!
PLUS NOTHING ELSE MAKES SENSE LOL!
In Python
Write the special method __str__() for CarRecord.
Sample output with input: 2009 'ABC321'
Year: 2009, VIN: ABC321
Answer:
def __str__(self):
return ('Year: %d, VIN: %s' %(self.year_made, self.car_vin))
Explanation:
Here you go! This should do it.
The program gives an implementation of the car record class which displays the model year and registration number of a car. The program written in python 3 goes thus :
class CarRecord :
#initialize a class named carRecord
def __init__(self):
#define the init method of the class
self.year_made = 0
#year car was made is initialized to 0 (integer)
self.car_vin = ' '
#vehicle registration is an empty string
def __str__(self):
#define an str method
return f"Year:{self.year_made}, VIN:{self.car_vin}"
#returns formatted display of the year and VIN number
my_car = CarRecord()
#creates an instance of the carRecord class
my_car.year_made = int(input())
#prompts user for the model year of the car
my_car.car_vin = input()
#prompts user for the model Vin number
print(my_car)
# display the details
A sample run of the program is given
Learn more :https://brainly.com/question/20504501
40 POINTS IF YOu ANSWER FOR EACH STEP.
When your friend DaJuan turns on his computer, he hears four beeps. The computer won’t fully boot. DaJuan has a Dell computer with a quad core processor and has recently upgraded his RAM.
Apply the troubleshooting methodology to help DaJuan understand and resolve his problem. The steps of the methodology are listed for you. Copy them into a document and use them to write suggestions for DaJuan at each step.
1.Identify the Problem
2.Internet Research
3.Establish a Theory of Probable Cause
4.Test the Theory
5.Establish a Plan of Action
6.Implement the Solution or Escalate
7.Verify Full System Functionality
8.Document Findings.
Answer:
4 beeps indicate a Memory Read / Write failure. Try re-seating the Memory module by removing and reinserting it in the slot. This could mean it could've just jiggled loose after a while or dust, there could be a hundred other problems but those are the two most common.n
Explanation:
Adjust list by normalizing When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 30 50 10 70 65 the output is: 20 40 0 60 55 The 5 indicates that there are five values in the list, namely 30, 50, 10, 70, and 65. 10 is the smallest value in the list, so is subtracted from each value in the list. For coding simplicity, follow every output value by a space, including the last one.
Answer:
Written in Python
inp = int(input("Length: "))
num = []
num.append(inp)
for i in range(1,inp+1):
userinp = int(input("Input: "))
num.append(userinp)
smallest = num[1]
for i in range(1,len(num)):
if smallest > num[i]:
smallest = num[i]
for i in range(1,len(num)):
num[i] = num[i] - smallest
for i in range(1,len(num)):
print(num[i],end=' ')
Explanation:
I've added the full program as an attachment where I used comments as explanation
thank you very much for your email. ...... was very interesting
Answer:
WHAT DO YOU MEAN
Explanation:
THIS IS FOR QUESTIONS ONLY !!!!
Create a C++ console application to store points for contestants in a contest. Ask the user for the number of contestants. Create two parallel dynamic arrays, one to store the names and one to store integer scores from zero to 100. Do not accept out of range numbers. Ask the user for each name and the score one at a time.
When you encounter the end of the array, print all names and scores. Also, print the average and indicate whether each score is above or below average. The example is attached in the file and I want you to get the same output on the shown display of the program.
Requirements:
1 Add comments as you code. Do NOT wait until you are done coding. Also, in the beginning of your codes include the following comments:
Purpose of the program,
Name of the author, and
Date
2 Tell the user what the program is all about.
3 Create a function to get the values from the user and store them in the arrays. Pass the pointers and array size to the function. This function will have a void return type.
4 Create a function to calculate the average. Pass a pointer and the size to the array. The function should return the average.
5 Create another function to print the result. Pass the pointers, the array size, and the average to the function.
6 Do not pass arrays to functions. Even though it is possible to do so, we are trying to practice using pointers.
7 All functions will be called only by the main. Prevent calling them by other functions.
8 No global variables are allowed.
9 Delete the arrays to free the memory after printing the results.
10 Ask the user if they want to continue. If so, ask the questions again.
11 Test, test, and test.
Hints:
Please, do NOT use 'break' or 'continue' in the code.
This is how you create a dynamic array: arrayPtr = new int[size];
Use this syntax to pass the pointer to a function: void display (string* namePtr){ }
Answer:
Open your python console and execute the following .py code
Explanation:
Code bellow:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
void inputInfo(string*, int*, int);
double mathAvr(int*, int);
void printInfo(string*, int*, int, double);
int main()
{
double avg;
int n;
string *names;
int *scores;
char ch;
do
{
cout << "\n contestants quantity: ";
cin >> n;
names = new string[n];
scores = new int[n];
inputInfo(names, scores, n);
avg = mathAvr(scores, n);
printInfo(names, scores, n, avg);
delete [] names;
delete [] scores;
cout << "\n again? (Y/N): ";
cin >> ch;
}while(ch=='Y' || ch=='y');
cout << "\n\n";
return 0;
}
void inputInfo(string *names, int *scores, int n)
{
int i;
for(i=0; i<n; i++)
{
cout << "\n\n Name of the participant: ";
cin >> *(names+i);
do
{
cout << "\n score " << *(names+i) << " (0-100): ";
cin >> *(scores+i);
}while(*(scores+i) < 0 || *(scores+i) > 100);
}
}
double mathAvr(int *scores, int n)
{
int i, sum=0;
double avg;
for(i=0; i<n; i++)
{
sum += *(scores+i);
}
avg = sum / (double)n;
return avg;
}
void printInfo(string *names, int *scores, int n, double avg)
{
int i;
cout << "\n\n " << left << setw(20) << "Participant name" << left << setw(6) << "Score" << " \n";
for(i=0; i<n; i++)
{
cout << "\n " << left << setw(20) << *(names+i) << left << setw(6) << *(scores+i);
}
cout << fixed << setprecision(2);
cout << "\n\n Average: " << avg << " \n\n";
}
Match letters from column B to Column A by looking at the picture above.
Answer:
The answer to this question is given below in the explanation section.
Explanation:
This question is about mapping correct terms with their number in the given picture. The correct matching of Column A and Column B is given below
Column A Column B
Horizontal axis 3
Legend 4
Vertical axis 2
Chart Data 1
The Gas-N-Clean Service Station sells gasoline and has a car wash. Fees for the car wash are $1.25 with a gasoline purchase of $10.00 or more and $3.00 otherwise. Three kinds of gasoline are available: regular at $2.89, plus at $3.09, and super at $3.39 per gallon. User Request:
Write a program that prints a statement for a customer. Analysis:
Input consists of number of gallons purchased (R, P, S, or N for no purchase), and car wash desired (Y or N). Gasoline price should be program defined constant. Sample output for these data is
Enter number of gallons and press 9.7
Enter gas type (R, P, S, or N) and press R
Enter Y or N for car wash and press Y
**************************************
* *
* *
* Gas-N-Clean Service Station *
* *
* March 2, 2004 *
* * ************************************** Amount Gasoline purchases 9.7 Gallons Price pre gallons $ 2.89 Total gasoline cost $ 28.03 Car wash cost $ 1.25 Total due $ 29.28 Thank you for stopping Pleas come again Remember to buckle up and drive safely
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
//print the header
System.out.println("**************************************");
System.out.println("* *");
System.out.println("* *");
System.out.println("* Gas-N-Clean Service Station *");
System.out.println("* *");
System.out.println("* March 2, 2004 *");
System.out.println("* *");
System.out.println("**************************************");
//set the constant values for gasoline
final double REGULAR_GASOLINE = 2.89;
final double PLUS_GASOLINE = 3.09;
final double SUPER_GASOLINE = 3.39;
// initialize the variables as 0
double gasolinePrice = 0, gasolineCost = 0, carWashCost = 0, totalCost = 0;
Scanner input = new Scanner(System.in);
//ask the user to enter the gallons, gas type and car wash choice
System.out.print("Enter number of gallons ");
double gasolinePurchase = input.nextDouble();
System.out.print("Enter gas type (R, P, S, or N) ");
char gasType = input.next().charAt(0);
System.out.print("Enter Y or N for car wash ");
char carWashChoice = input.next().charAt(0);
//check the gas type. Depending on the choice set the gasolinePrice from the corresponding constant value
if(gasType == 'R')
gasolinePrice = REGULAR_GASOLINE;
else if(gasType == 'P')
gasolinePrice = PLUS_GASOLINE;
else if(gasType == 'S')
gasolinePrice = SUPER_GASOLINE;
//calculate the gasolineCost
gasolineCost = gasolinePurchase * gasolinePrice;
//check the carWashChoice. If it is yes and gasolineCost is greater than 10, set the carWashCost as 1.25. Otherwise, set the carWashCost as 3.00
if(carWashChoice == 'Y'){
if(gasolineCost >= 10)
carWashCost = 1.25;
else
carWashCost = 3.00;
}
//calculate the total cost, add gasolineCost and carWashCost
totalCost = gasolineCost + carWashCost;
//print the values in required format
System.out.println("Amount Gasoline purchases " + gasolinePurchase);
System.out.println("Gallons Price per gallons $ " + gasolinePrice);
System.out.printf("Total gasoline cost $ %.2f\n", gasolineCost);
System.out.println("Car wash cost $ " + carWashCost);
System.out.printf("Total due $ %.2f\n", totalCost);
System.out.println("Thank you for stopping\nPlease come again \nRemember to buckle up and drive safely");
}
}
Explanation:
*The code is in Java.
Please see the comments in the code for explanation
Write a program which simulate rolling dice. When the program runs, it will prompt the user to choose a number ranging from 1 to 6. It will then randomly choose a number between 1 and 6. The program will print the message "Your guess is correct!" if the guess number equals to the dice number, otherwise it will print "Wow! The dice number is --.". It should then ask the user if you’d like to roll again. Enter "1" to roll again and enter "0" to end the game. Concepts to keep in mind:
Concepts to keep in mind:
• Random
• Integer
• Print
• While Loops
Output:
Enter your guess number between 1 and 6: 5
Wow! The dice number is 1
Do you want to dice it up again:Enter 1 and if not enter 01
Enter your guess number between 1 and 6: 4
Wow! The dice number is 1
Do you want to dice it up again:Enter 1 and if not enter 01
Answer:
Written in Python
import random
tryagain = 1
while tryagain == 1:
guess = int(input("Enter your guess number between 1 and 6: "))
num = random.randint(1,7)
if guess == num:
print("Your guess is correct")
else:
print("Wow, the dice number is "+str(num))
tryagain = int(input("Do you want to dice it up again:Enter 1 and if not enter 0: "))
Explanation:
I've added the full source code as an image attachment where I used comments to explain difficult lines
Using Phyton
Write a program with the following functions.
function 1: Accepts 2 strings as arguments. returns true if the second string is a part of the first string.
def something(string1, string2):
return True if string2 in string1 else False
This would be the most concise way of writing this function.
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program:
Min miles: -10
Max miles: 40
Here's what I have so far:
import java.util.Scanner;
public class ArraysKeyValue {
public static void main (String [] args) {
final int NUM_ROWS = 2;
final int NUM_COLS = 2;
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS];
int i = 0;
int j = 0;
int maxMiles = 0; // Assign with first element in milesTracker before loop
int minMiles = 0; // Assign with first element in milesTracker before loop
milesTracker[0][0] = -10;
milesTracker[0][1] = 20;
milesTracker[1][0] = 30;
milesTracker[1][1] = 40;
//edit from here
for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] > maxMiles){
maxMiles = milesTracker[i][j];
}
}
}
for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] < minMiles){
minMiles = milesTracker[i][j];
}
}
}
//edit to here
System.out.println("Min miles: " + minMiles);
System.out.println("Max miles: " + maxMiles);
}
Answer: 40, 4
Explanation:
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));
}
}
Which of the following is NOT an example of input?
a
voice command
b
mouse clicks
c
keyboard strokes
d
a pop-up box
Answer:
a pop-up box
Explanation:
A voice command, mouse clicks, or keyboard strokes is the user doing something. But a pop-up box is not. I realize that a popup box could contain a user input, but the box itself is not any sort of user input. It's the opposite.
"Jean-luc Doumont notes that slide software is an effective presentation tool, especially when the speech goal is to:"
Hi, your question is incomplete. Here are the options:
A. persuade the audience.
B, encourage critical thinking.
C. increase discussion.
D. relay detailed information
Answer:
D. relay detailed information
Explanation:
Indeed, slide software (like MS Powerpoint) would be an effective presentation tool, especially when the speech goal is to relay detailed information.
For example, a graph showing the exponential growth in the number of smartphone users in the United States for the last 15 years would be effectively presented using a slide that shows this data because it will allow the audience to easily see the detailed information.
Write a program which:
Allows the user to input any of the following string: A1, A2, B1, B2, C1, C2
If the input is from the A category, the program must output "Footwear: ". And if the input is A1 it should output "Shoes" and if A2 it should output "Trainers"
B should output "Tops: "
B1 "Jackets"
B2 "TShirts"
C "Pants: "
C1 "Trousers"
C2 "Shorts"
If the user has not entered the correct data, the program must output "Incorrect input"
Answer:
Ill do this in C# and Java
Explanation:
C#:
public static void Main(string[] args)
{
string input = Console.ReadLine();
switch (input)
{
case "A1":
Console.WriteLine("Footwear:");
Console.WriteLine("Shoes");
break;
case "B1":
Console.WriteLine("Tops:");
Console.WriteLine("Jackets");
break;
case "C1":
Console.WriteLine("Pants:");
Console.WriteLine("Trousers");
break;
case "A2":
Console.WriteLine("Footwear:");
Console.WriteLine("Trainers");
break;
case "B2":
Console.WriteLine("Tops:");
Console.WriteLine("TShirts");
break;
case "C2":
Console.WriteLine("Pants:");
Console.WriteLine("Shorts");
break;
default:
Console.WriteLine("Incorrect Input");
break;
}
}
Java:
public static void main(String[] args)
{
Scanner myObj = new Scanner(System.in); // Create a Scanner object
String input = myObj.nextLine();
{
switch (input)
{
case "A1":
System.out.println("Footwear:");
System.out.println("Shoes");
break;
case "B1":
System.out.println("Tops:");
System.out.println("Jackets");
break;
case "C1":
System.out.println("Pants:");
System.out.println("Trousers");
break;
case "A2":
System.out.println("Footwear:");
System.out.println("Trainers");
break;
case "B2":
System.out.println("Tops:");
System.out.println("TShirts");
break;
case "C2":
System.out.println("Pants:");
System.out.println("Shorts");
break;
default:
System.out.println("Incorrect Input");
break;
}
}
(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;
}
}
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 – printing out each of
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));
}
}
best answer brainliest :)
ridiculous answers just for points will be reported
thank you! Most jobs in information technology require expertise in _____.
most of the layers
all of the layers
one layer
a couple of the layers
Answer:
all of the layers
Explanation:
Answer:
a couple of the layers
Explanation: says it in the first sentence in the last paragraph of this image
How can a LAN be changed into a WAN?
Answer:
I hope the above picture may help you.
Jake or Peggy Zale must fix quickly the fax.
Answer:
Sentence: Jack or Peggy Zale must fix quickly the fax.
Correct: Either Jack or Peggy Zale must quickly fix the fax.
There are 2 errors in these sentence construction. In stating two persons as an option we must use the word "either" to indicate that you only have two choose from the two of them. The word "
Explanation:
The correct sentence would be "either Jake or Peggy Zale must quickly fix the fax".
In the question construction, there is a conjunction and misarrangement error.
In conclusion, the word " "either Jake or Peggy Zale must quickly fix the fax" is correct
Read more about conjunction
brainly.com/question/8094735