Answer:
b
Explanation:
Answer:
B. Online Predators
Explanation:
Java Eclipse homework. I need help coding this
Project Folder: Lesson 03
package: challenge3B
Class: ChallengeProject3B
Complete the code challenge below.
(You will need to use escape sequences to print the \ and “ characters )
Write a program that displays the following:
1. Write code that displays your name inside a box on the console screen, like this:
+-----------------+
| Your Name |
+-----------------+
2. Write code that prints a face, using text characters, hopefully better looking than this one:
//////
| o o |
(| ^ |)
| \_/ |
-------
3. Write code that prints a tree:
/\
/ \
/ \
/ \
--------------
“ “
“ “
“ “
public class ChallengeProject3B{
public static void main(String [] args){
System.out.println("+-----------------+");
System.out.println("| YOURNAME |");
System.out.println("+-----------------+");
System.out.println("\n//////");
System.out.println("| o o|");
System.out.println("|\\_/|");
System.out.println("-----");
System.out.println("\n/\\");
System.out.println("/\\");
System.out.println("/\\");
System.out.println("/\\");
System.out.println("--------------");
}
}
I hope this helps!
The early success of Microsoft was cemented by the release of which software product:
A) Altair BASIC
B) MS-DOS for the IBM PC
C) IBM’s OS/360
D) P/M
Answer:
MS-DOS for the IBM PC
Explanation:
Shortly after its launch most personal computer companies adopted MS-DOS as their operating system.
Answer:
basically B
Explanation:
the person above is correct
Choose all of the items that represent functions of an operating system.
1)manages peripheral hardware devices
2) runs software applications
3) manages user accounts and passwords
4) manages network connections
5) generates system error messages
Answer:
Its all 5 of them
Explanation:
Just did it on EDG
Answer:
all 5
Explanation:
all 5
Determine whether the compound condition is True or False.
4 < 3 and 5 < 10
4 <3 or 5 < 10
not (5 > 13)
Answer:
The answer to this question is given below in the explanation section.
Explanation:
The given compound statement are:
4 < 3 and 5 < 10
4 <3 or 5 < 10
not (5 > 13)
4 < 3 and 5 < 10 this statement is false because "and" logical operator required that both operand (4<3) and (5<10) are true. Statement (4<3) is a false statement so this statement is false. "and" operator becomes true when all its inputs are true otherwise it becomes false.
4 < 3 or 5 < 10 this statement is true because "or" logical operator to be true if one of its input is true and false when all inputs are false. so in this compound statement, the first statement is false and the second statement is true. so this compound statement is true.
not(5>13) this compound statement is true because it has "not" operator and "not" operator makes a false statement to true and vice versa. so (5>13) is a false statement, and when you append "not" operator before it, then this compound statement will become true statement, so this is a true statement.
The given compound conditions would be considered true or false as follows:
i). 4 < 3 and 5 < 10 - False
ii). 4 <3 or 5 < 10 - True
iii). not (5 > 13) - True
i). 4 < 3 and 5 < 10 would be considered false and the reason behind this is that the logical operator 'and' implies that both are equivalent but here 4 < 3 is incorrect as it differentiates from the meaning conveyed in 5 < 10ii). In the second statement i.e. 4 <3 or 5 < 10, 'or' is the correct logical operator because one of the parts i.e. 5 < 10 is actually true while the latter is false.iii) In the next part "not (5 > 13)" is also true as it adequately uses the operator 'not' to imply that 5 is not bigger than 13 which implies it to be true.
Thus, the first statement is false and the other two are true.
Learn more about 'Compound Condition' here:
brainly.com/question/1600648
If you cut a piece of text but intended to copy it, what command can you use to correct your error?
Format painter
Paste
Redo
Undo
Answer:
It should be undo, as the deleted text is pasted. You can then, copy it.
Answer:
undo
Explanation:
you can undo the cutting and copy instead
JAVA Write a program that first asks the user to type a letter grade and then translates the letter grade into a number grade. Letter grades are A, B, C, D, and F, possibly followed by + or –. Their numeric values are 4, 3, 2, 1, and 0. There is no F+ or F–. A + increases the numeric value by 0.3, a – decreases it by 0.3. However, an A+ has value 4.0. Use a class Grade with a method getNumericGrade. Also provide a tester class. Use -1 as a sentinel value to denote the end of letter grade inputs. The running results of your program should be like: Please enter a letter grade (enter -1 to end the input): B- The numeric value is 2.7. Please enter a letter grade (enter -1 to end the input):C The numeric value is 2.0. Please enter a letter grade (enter -1 to end the input):-1 The grade translation ends.
Answer:
Follows are the code to this question:
import java.util.*;//import package for user input
class GradePrinter//defining class GradePrinter
{
double numericValue = 0;//defining double variable
String grade = "";//defining String variable
GradePrinter()//defining default constructor
{
Scanner xb = new Scanner(System. in );//defining Scanner class object
System.out.print("Enter Grade: ");//print message
grade = xb.nextLine();//input string value
}
double getNumericGrade()//defining double method getNumericGrade
{
if (grade.equals("A+") || grade.equals("A"))//defining if block that check input is A+ or A
{
numericValue = 4.0;//using numericValue variable that hold float value 4.0
}
else if (grade.equals("A-"))//defining else if that check grade equals to A-
{
numericValue = 3.7;//using numericValue variable that hold float value 3.7
}
else if (grade.equals("B+"))//defining else if that check grade equals to B-
{
numericValue = 3.3;//using numericValue variable that hold float value 3.3
}
else if (grade.equals("B"))//defining else if that check grade equals to B
{
numericValue = 3.0;//using numericValue variable that hold float value 3.0
}
else if (grade.equals("B-"))//defining else if that check grade equals to B-
{
numericValue = 2.7;//using numericValue variable that hold float value 2.7
}
else if (grade.equals("C+"))//defining else if that check grade equals to C+
{
numericValue = 2.3; //using numericValue variable that hold float value 2.3
}
else if (grade.equals("C")) //defining else if that check grade equals to C
{
numericValue = 2.0; //using numericValue variable that hold float value 2.0
}
else if (grade.equals("C-")) //defining else if that check grade equals to C-
{
numericValue = 1.7;//using umericValue variable that hold float value 1.7
}
else if (grade.equals("D+"))//defining else if that check grade equals to D+
{
numericValue = 1.3;//using umericValue variable that hold float value 1.3
}
else if (grade.equals("D"))//defining else if that check grade equals to D
{
numericValue = 1.0;//using umericValue variable that hold float value 1.0
}
else if (grade.equals("F"))//defining else if that check grade equals to F
{
numericValue = 0;//using umericValue variable that hold value 0
}
else//defining else block
{
System.out.println("Letter not in grading system");//print message
}
return numericValue;//return numericValue
}
}
class Main//defining a class main
{
public static void main(String[] args)//defining main method
{
GradePrinter ob = new GradePrinter();// creating class GradePrinter object
double numericGrade = ob.getNumericGrade();//defining double variable numericGrade that holds method Value
System.out.println("Numeric Value: "+numericGrade); //print Value numericgrade.
}
}
Output:
Enter Grade: B
Numeric Value: 3.0
Explanation:
In the above-given code, a class "GradePrinter" is defined inside the class a string, and double variable "grade and numericValue" is defined, in which the grade variable is used for input string value from the user end.
After input, the sting value a method getNumericGrade is defined, which uses multiple conditional statements is used, which holds double value in the which is defined in the question.
In the main class, the "GradePrinter" object is created and defines a double variable "numericGrade", that calling method and store its value, and also use print method to print its value.
This needs to be written in Java.
Create an Automobile class for a dealership. Include fields for an ID number, make, model, color, year, vin number, miles per gallon, and speed. Include get and set methods for each field. Do not allow the ID to be negative or more than 9999; if it is, set the ID to 0. Do not allow the year to be earlier than 2000 or later than 2017; if it is, set the year to 0. Do not allow the miles per gallon to be less than 10 or more than 60; if it is, set the miles per gallon to 0. Car speed should be initialized as 0. Include a constructor that accepts arguments for each field value and uses the set methods to assign the values. Also write two methods, Accelerate () and Brake (). Whenever Accelerate () is called, increase the speed by 5, and whenever Brake () is called, decrease the speed by 5. To allow users to specify the speed to increase (or decrease), create two overloading methods for Accelerate () and Brake () that accept a single parameter specifying the increasing (or decreasing) speed. Write an application that declares several Automobile objects and demonstrates that all the methods work correctly. Save the files as Automobile.java and TestAutomobiles.java
Answer:
Here is Automobile.java
class Automobile { //class name
private int ID, year, milesPerGallon, speed = 0; // private member variables of Automobile of int type
private String model, vinNo, make, color; // private member variables of Automobile of String type
public void setID(int ID){ //mutator method to set ID
if (ID >= 0 && ID <= 9999) // checks ID should not be negative or more than 9999
this.ID = ID;
else this.ID = 0; } //if ID is negative or greater than 9999 then set ID to 0
public void setModel(String model){ // mutator method to set model
this.model = model; }
public void setYear(int year){// mutator method to set year
if (year >= 2000 && year <= 2017) //checks that year should not be earlier than 2000 or later than 2017
this.ID = ID;
else this.year = 0; } //if year is less than 2000 or greater than 2017 then set year to 0
public void setVinNo(String vinNo){ //mutator method to set vin number
this.vinNo = vinNo; }
public void setMilesPerGalon(int milesPerGallon){ //mutator method to set miles per gallon
if (milesPerGallon >= 10 && year <= 60) //checks that miles per gallon should not be less than 10 or more than 60
this.milesPerGallon = milesPerGallon;
else this.milesPerGallon = 0; } //if it is more than 60 or less than 10 then set miles per gallon to 0
public void setSpeed(int speed){ //mutator method to set speed
this.speed = speed; }
public void setMake(String make){ //mutator method to set make
this.make = make; }
public void setColor(String color){ //mutator method to set color
this.color = color; }
public int getID() //accessor method to get or access ID
{return ID;} //returns the current ID
public String getModel() //accessor method to get or access model
{return model;} //returns the current model
public int getYear()// accessor method to get or access year
{return year;} //returns the current year
public String getVinNo() // accessor method to get or access vin number
{return vinNo;} //returns the current vin number
public int getMilesPerGallon() //accessor method to get or access miles per gallon
{return milesPerGallon;} //returns the current miles per gallon
public int getSpeed() //accessor method to get or access speed
{return speed;} //returns the current speed
public String getMake() //accessor method to get or access make
{return make;} //returns the current make
public String getColor() //accessor method to get or access color
{return color;} //returns the current color
public int Accelerate() { //method that increase speed by 5
setSpeed(speed + 5); //calls set speed to add 5 to the speed field
return speed; } //returns the speed after increasing 5
public int Brake() { //method that decreases speed by 5
setSpeed(speed - 5);//calls set speed to subtract 5 from the speed field
return speed; } //returns the speed after decreasing 5
public int Accelerate(int spd) { //overloading methods for Accelerate()that accepts a single parameter spd
setSpeed(speed + spd); //increases speed up to specified value of spd
return speed; }
public int Brake(int spd) { //overloading methods for Brake()that accepts a single parameter spd
setSpeed(speed - spd); //decreases speed up to specified value of spd
return speed; }
public Automobile(int ID, String make, String model, int year, String vinNo, int milesPerGallon, int speed, String color){ //constructor that accepts arguments for each field value and uses the set methods to assign the values
setID(ID);
setModel(model);
setYear(year);
setVinNo(vinNo);
setMilesPerGalon(milesPerGallon);
setSpeed(speed);
setMake(make);
setColor(color); } }
Explanation:
Here is TestAutomobiles.java
public class TestAutomobiles { //class name
public static void main(String args[]) { //start of main method
Automobile auto = new Automobile(123, "ABC", "XYZ", 2010, "MMM", 30, 150, "White"); //creates an object of Automobile class and calls its constructor passing the values for each of the fields
System.out.println("Initial Speed: " + auto.getSpeed()); //calls getSpeed method to get the current speed using object auto. The current speed is 150
System.out.println("Speed after applying acceleration: " + auto.Accelerate()); //calls Accelerate() method to increase the current speed to 5
System.out.println("Speed after applying brake: " + auto.Brake()); //calls Brake() method to decrease the current speed to 5
System.out.println("Speed after applying acceleration: " + auto.Accelerate(180)); //calls overloading Accelerate() method to increase the current speed to 180
System.out.println("Speed after applying brake: " + auto.Brake(50)); } } //calls overloading Brake() method to decrease the current speed to 50
//The screenshot of the output of the program is attached.
Which insert image option allows a user to compile, modify, and add captions to images?
Pictures
Screenshot
Photo Album
Online Pictures
Answer:
heres my answer and my proof
Explanation:
Photo Album is insert image option allows a user to compile, modify, and add captions to images. Hence, option C is correct.
What is a Photo Album?A piece of software called a digital picture album allows users to upload image files from a computer's hard drive, memory card, scanner, or digital camera to a central database.
A bound or loose-leaf book with blank pages, pockets, envelopes, etc. used for displaying or storing photographs, stamps, and other valuables, as well as for autographs. an audio compilation of various musical selections, a whole drama, an opera, etc.
The paper of your choosing is directly printed with the images for your picture book. In picture albums, photo prints are commonly adhered to the pages. Photo books are frequently lighter and thinner than conventional photo albums, taking up less room on the coffee table or shelf.
Thus, option C is correct.
For more information about Photo Album, click here:
https://brainly.com/question/20719259
#SPJ2
Which of the following statements is true of wireless cellular networks? Check all of the boxes that apply.
They operate on a grid pattern.
They must conform to IEEE 802.11 standards.
They search for signals to confirm that service is available.
They provide voice communications and Internet connectivity.
Answer:
1,3,4
Explanation:
They operate on a grid pattern
They search for signals to confirm that service is available.
They provide voice communications and Internet connectivity.
Answer:1, 3, 4
Explanation:edge 2023
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:
Replace /* Type your code here. */ with the following lines of code
int quarter =scnr.nextInt();
int dime = scnr.nextInt();
int nickel = scnr.nextInt();
int penny = scnr.nextInt();
double dollars = quarter * 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:
The next four lines declare the given currencies as integer
int quarter =scnr.nextInt();
int dime = scnr.nextInt();
int nickel = scnr.nextInt();
int penny = scnr.nextInt();
This line calculates the amount in dollars
double dollars = quarter * 0.25 + dime * 0.1 + nickel * 0.05 + penny * 0.01;
The next two lines print the amount in dollars and cents respectively
System.out.printf("Amount: $%.2f\n", dollars);
System.out.print((dollars * 100)+" cents");
Given four values representing counts of quarters, dimes, nickels and pennies, the total amount in dollars and cent can be represented as follows;
#1 quarters = 0.25 dollars
#1 dime = 0.1 dollar.
#1 nickel = 0.05 dollars
#1 penny = 0.01 dollars
#quarters, dimes, nickels and pennies,
x = input("write your input here: ")
for i in x:
quarters = 0.25*float(x[0])
dime = 0.1*float(x[1])
nickel = 0.05*float(x[2])
penny = 0.01*float(x[3])
sum1 = quarters + dime + nickel + penny
print(round(sum1, 2))
Code explanation:The commented section of the code is just the conversion rate of quarters, dime, nickel and penny to dollars.
Variable x is used to store the user's input.Then, we loop through the users inputThen multiply each looped value by it conversion rate to dollars.Finally, we sum the values and print the sum rounded to 2 decimal places as required.learn more on python code here: https://brainly.com/question/24556911?referrer=searchResults
9. A change in the appearance of a value or label in a cell
a) Alteration
b) Format
c) Indentation
d) Design
10. The placement of information within a cell at the left edge, right ed
a) Indentation
b) Placement
c) Identification
d) Alignment
11. Spreadsheet can be best classified as
a) Word
b) Database
c) Excel
d) Outlook
12. Formulas in Excel start with
Answer:
format
alignment
excel
=
Explanation: i'm an accountant
A change in the appearance of a value or label in a cell is format. The placement of information within a cell at the left edge, right edge is alignment, and spreadsheet can be best classified as Excel. The correct options are b, d, and c respectively.
What exactly does a spreadsheet mean?A spreadsheet, also known as an electronic work sheet, is a computer program that organizes data into graph-like rows and columns. Formulas, commands, and formats can be used to manipulate each row and column.
Spreadsheets are most commonly used to store and organize data such as revenue, payroll, and accounting information. Spreadsheets allow the user to perform calculations on the data and generate graphs and charts.
Format is a change in the appearance of a value or label in a cell. The alignment of information within a cell at the left edge, the alignment of information within a cell at the right edge, as well as spreadsheets are usually best classified as Excel.
Thus, b, d, and c respectively are correct options.
For more details regarding spreadsheet, visit:
https://brainly.com/question/8284022
#SPJ6
html tags are surrounded by which types of brackets
Next, Kim decides to include a diagram of a frog’s life cycle in her presentation. She wants to use an image that is part of a previous presentation stored on her laptop. Which actions can help her work with two presentations at once to copy and paste the image? Check all that apply.
Click Move Split.
Use the Alt+Tab keys.
Use the Windows+Tab keys.
Choose Arrange All in the View tab.
Select Fit to Window in the View tab.
Choose Switch Windows in the View tab.
Answer:
B, C, D, and F are correct answers
Explanation:
On edg
Answer: use alt+tab keys
Use the windows+tab key
Choose arrange all in the view tab
Choose switch windows in the view tab
Explanation:
Ken has inserted an image into his PowerPoint presentation, but the image contains a lot of empty and/or unnecessary space. He needs to eliminate this space. Which option should he use to achieve this goal?
cut
copy
crop
adjust
Answer:
C. crop
Explanation:
Answer:
c
Explanation:
how would you share information and communicate news and events
Answer:
You could use Print things (mail, books, etc.) or Online things (internet, social media, etc.)
Hope this helps :)
Code a program that asks the user for a bank savings account balance and an annual interest rate that is paid to the account. You are to display what the balance will be after one year, after two years, and after three years. We can assume that the interest compounds annually (no need to ask for compounding criteria or use the natural number for continuously compounding interest, whew!) If the balance after adding the interest paid to the user exceeds $1000 then let the user know that they are now a silver bank club member. If it exceeds $5000 then let the user know that they are now a gold bank club member. If it exceeds $10000 then let the user know that they are now a platinum bank club member. If they qualify for any of these exclusive member statuses then you should tell them by how much they are exceeding the minimum balance for that status.
The interest rate will need to be input whole numbers (ex: 15), but *hint* remember that you will need to divide by 100 to obtain the rate expressed as a decimal.
A- The structure of the program must follow the sample programs provided in the text.
B- The program will need to provide clear, explicit instructions.
C- The program will need to display clear statements for the balance and exceeding amount for the exclusive club status for each year.
Answer:
is_silver = False
is_gold = False
is_premium = False
balance = float(input("Enter the balance: "))
rate = float(input("Enter the annual interest rate: "))
for i in range(3):
balance += balance * 0.15
print("The balance after " + str(i+1) + " year is $" + str(balance))
if balance > 10000 and is_premium == False:
print("You are now a premium bank club member.")
is_premium = True
print("You are exceeding " + str(balance - 10000) + "$ for that status")
elif balance > 5000 and is_gold == False and is_premium == False:
print("You are now a gold bank club member.")
is_gold = True
print("You are exceeding " + str(balance - 5000) + "$ for that status")
elif balance > 1000 and is_silver == False and is_gold == False and is_premium == False:
print("You are now a silver bank club member.")
is_silver = True
print("You are exceeding " + str(balance - 1000) + "$ for that status")
Explanation:
*The code is in Python.
Set the is_silver, is_gold and is_premium as False
Ask the user to enter the balance and rate
Create a for loop that iterates three times. Inside the loop:
Add the interest to the balance (cumulative sum)
Print the balance
Check the balance. If it is greater than 10000 and is_premium is False, state that the customer is a premium member, set the is_premium as True, and state how much s/he is exceeding the minimum balance for that status. If the balance is greater than 5000, is_gold is False and is_premium is False, state that the customer is a gold member, set the is_gold as True, and state how much s/he is exceeding the minimum balance for that status. If the balance is greater than 1000, is_silver is False, is_gold is False and is_premium is False, state that the customer is a silver member, set the is_silver as True, and state how much s/he is exceeding the minimum balance for that status.
You should avoid storing files and folders on the blank
Answer:
why
Explanation:
Write a Console Java program that asks the user to enter one sentence on the keyboard. Output on the console:
1) The number of words in the sentence
2) A count of each alphabet in the sentence in alphabetical order (ignore zero counts, ignore Upper/Lowercase difference. That is, count 'A' and 'a' as the same) . Assume that the user will enter a sentence with alphabets. No need to validate user entry. Example: Sentence: This is a great Fall Semester Number of words: 6 a-3, e-4. f-1, g-1, h-1, i-2, l-2, m-1, r-2 , s-4, t-3
Answer:
Here is the JAVA program:
import java.util.Scanner; //to accept input from user
public class Main{ //class name
public static void main(String[] args){ //start of main function
String sentence; //to store the input sentence
int i, length; //declare variables
int count[] = new int[256]; //creates a counter array
Scanner input = new Scanner(System.in); //creates Scanner class object to accept input from user
System.out.println("Enter a sentence: "); //prompts user to enter a sentence
sentence = input.nextLine(); //scans and reads the entire sentence string from user
String[] words = sentence.split("\\s+"); //splits the sentence into an array with separator as one or more white spaces and stores this array in words
System.out.println("Number of words: " + words.length); //display the number of words in sentence by using length which returns the length of the words array
sentence = sentence.toLowerCase(); // converts the sentence into lower case to ignore case sensitivity
sentence = sentence.replaceAll("\\s+",""); //removes the empty spaces from sentence
length = sentence.length(); //stores the length of the sentence string into length variable
for (i = 0; i < length; i++) { //iterates through the length of the sentence
count[(int) sentence.charAt(i)]++; } //counts occurrence of each alphabet in the sentence and stores it in count array
for (i = 0; i < 256; i++) { displays occurrence of alphabet in sentence
if (count[i] != 0) { //if count array is not empty
System.out.println((char) i + "-" + count[i]); }}}}
//prints each alphabet and its count
Explanation:
The program prompts the user to enter a sentence. Suppose the user enters "We won" so
sentence = "We won"
Now this sentence splits into an array with white space as separator and stored in words array. So words array has two words of sentence now i.e. "We" and "won"
Next words.length is used to return the length of words array. So length of words array is 2 hence
number of words = 2
Next the sentence is converted to lower case and spaces are removes so sentence becomes:
wewon
sentence.length() returns the length of sentence which is 5.
Next the for loop is used. At each iteration of this loop occurrence each character of sentence is added to the count[] array. charAt() is used to return a character at each index position of string. So the frequency of every character is counted and stored in count array.
Next is a for loop that is used to display each alphabet in the sentence along with its frequency in alphabetic order.
Hence the entire program gives the output:
Number of words: 2 e-1 n-1 o-1 w-2
The screenshot of the output of example given in the question is attached.
5.24 LAB: Two smallest numbers Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input begins with an integer indicating the number of integers that follow. You can assume that the list will have at least 2 integers and less than 20 integers. Ex: If the input is: 5 10 5 3 21 2 the output is: 2 3 To achieve the above, first read the integers into an array. Hint: Make sure to initialize the second smallest and smallest integers properly. 265236.1527390
Answer:
Here is the C++ program:
#include <iostream> //to use input output function
#include <vector> //to use vectors
using namespace std; //to identify objects like cin cout
int main() { //start of main method
int size, number; //to store size of list and input numbers
cout<<"Enter list size: "; //prompts user to enter size of the list
cin >> size; //reads list size from user
vector<int> v; //creates a vector named v
for (int i = 0; i < size; ++i) { //iterates till the size of list reaches
cin >> number; //reads the input numbers
v.push_back(number); } //push number into a vector from the back
int num1 = v[0], num2 = v[1], current , temp; //num1 is set to the element at 0-th position of v and num2 is set to be on 1st index of v
if (num1 > num2) { //if num1 is is greater than num2
temp = num1; //assigns value of num1 to temp
num1 = num2; //assigns value of num2 to num1
num2 = temp; } //assigns value of temp to num2
for (int i = 2; i < size; ++i) { //iterates size times
current = v[i]; //set current to the i-th index of v
if (current < num1) { //if current is less than num1
num2 = num1; //assigns value of num1 to num2
num1 = current; } //assigns value of current to num1
else if(current < num2) { //if value of current is less than num2
num2 = current; } } //assigns value of current to num2
cout<<num1<< " "<<num2<< endl; } //dispalys num1 and num2 i.e. two smallest integers in ascending order
Explanation:
I will explain the program with an example.
Lets say the list size is 4 and numbers are 1 2 3 4
for (int i = 0; i < size; ++i)
This loop reads each number (1,2,3,4) and adds that number to the vector v which is the sequence container. The method push_back is used which inserts each number into the vector at the end, after the current last number and the vector size is increased by 1.
Next num1 = v[0] becomes num1 = 1
and num2 = v[1] becomes num1 = 2
if (num1 > num2) this condition is false so program moves to the statement:
for (int i = 2; i < size; ++i)
current = v[i]; becomes current = v[2]; which is current = 3
if (current < num1) is false so program moves to :
else if(current < num2) this is also false.
So the program moves to the statement:
cout<<num1<< " "<<num2<< endl;
which prints these two numbers 1 and 2 on output screen as the two smallest integers in the list in ascending order. Hence the output of the program is:
1 2
The screenshot of output of the program is attached.
Answer:
integers=[]
while True:
number=int(input())
if number<0:
break
integers.append(number)
print("",min(integers))
print("",max(integers))
Explanation:
Let T be the statement: The sum of any two rational numbers is rational. Then T is true, but the following "proof is incorrect. Find the mistake. "Proof by contradiction: Suppose not. That is, suppose that the sum of any two rational numbers is not rational. This means that no matter what two rational numbers are chosen their sum is not rational. Now both 1 and 3 are 1/1 and 3 3/1, and so both are ratios of integers with rational because 1 a nonzero denominator. Hence, by a supposition, the sum of 1 and 3, which is 4, is not rational. But 4 is rational because 4 4/1 , which is a ratio of integers with a nonzero denominator. Hence 4 is both rational and not rational, which is a contradiction. This contradiction shows that the supposition is false and hence statement T is true.
Answer:
the mistake is in the first statement.
Explanation:
Now lets us put the statement into consideration:
"The sum of any two rational numbers is irrational"
The negation is: " there exists a pair of rational numbers whose sum is irrational". (Existence of at least one of such a pair).
The negation is not "the sum of any two rational numbers is irrational"
Therefore the mistake is in the first statement and it is due to incorrect negation of the proof.
who could be involved in the murder of Mr Douglas
Answer:
Freedy Thopson
Explanation:
asking questions is super in this education life
After applying transitions to his presentation, Omar uses the Slide Show feature to view the them. He notices that the transitions he applied do not occur between all the slides.
Which step did Omar forget to do?
Right-click the mouse.
Press the OK button.
Click the Apply To All button.
Uncheck the On Mouse Click box.
Answer:
Its C
Explanation:
On Edg
Answer: Click the apply to all button
Explanation:
To close a window in Windows 10, you can _____. Select all that apply. A. right-click its button on the taskbar, then click Close window B. click the Close button in the upper-right corner of the window C. click the Close button in the window's thumbnail on the taskbar D. click the Start button and click the program name or icon
Answer:
A, B and C
Explanation:
A, B and C
(The following is unrelated to the answer just to fill the letters criteria)
For closing the window in Windows 10, the following steps should be considered:
The right-click should be done on the taskbar and then click on the close window.On the upper-right corner of the window, click on the close button.On the window thumbnail that shows on the taskbar, click on the close button.Now if we click on the start button and then click the program icon so the particular program opens instead of closing it.
Therefore the above steps are considered for closing out the window in windows 10.
Learn more about windows 10 here: /brainly.com/question/19652025
What is the output of the following program?
S = "foo"
t = "bar"
print(((s+t)*3).count("barf"))
The output of the following program is 2.
What is output of this program?S = "foo"
t = "bar"
print(((s+t)*3).count("barf"))
here we get The output is 2
Information that is processed and sent out by a program or another electronic device is considered its output. The output is anything that is audible on the display screen, such as the words you type on the keyboard.The term "output" refers to any data that a computer or other electronic device processes and sends. Anything that can be seen on a computer screen, such as the text you write on a keyboard, is an example of output.To learn more about output refer to:
https://brainly.com/question/27646651
#SPJ2
How and why does the daily path of the sun across the sky change for different locations on Earth?
Answer:
how does the daily path of the sun across the sky change with the seasons?
The path is curved due to Earth's tilted axis. During the days with longer periods of daylight, more light and heat from the Sun strike that hemisphere. So, when the Sun is higher in the sky, its energy is more concentrated on Earth's surface.
______ means locating a file among a set of files
Locating a file among set of flies is called file system.
As a producer you are willing to supply the most goods at the highest price this is because the highest price earns you the
Answer:
most money
Explanation:
common sense
The graphical user interface (GUI) was pioneered in the mid-1970s by researchers at:
A) Apple Computer
B) Microsoft
C) Xerox
D) IBM
Answer:
its C actually
Explanation:
C) Xerox plus i had a quiz
Answer:
xerox
Explanation:
What steps should a user take to create a secondary address book?
Open the Backstage view and Account Settings.
Open the Backstage view, and click People options.
Open the People view, and click New Address Book.
Open the People view, click Folder tab, and click New Folder.
Answer:
It's A
Explanation:
correct on edg
Answer:
A is correct on edg
Explanation:
What is the solubility of an empty soda can
Answer:
Around 2.2 grams.
Explanation:
2.2 g CO2∗1 mol CO244 g CO2=0.05 mol
355 mL∗1 L1000 mL=0.355 L
So here we can see we have about 0.05 mol/0.355 L or about 0.14 mol of carbon dioxide per liter of soda. Of course this value varies by manufacturer, type of drink, container, etc.