Answer:
The program in Python is as follows:
def swap(number1,number2):
number1,number2 = number2,number1
return number1, number2
first = int(input("First: "))
second = int(input("Second: "))
print("You input the numbers as ",first,"and",second)
first,second= swap(first,second)
print("After swapping\nFirst: ",first,"\nSecond:",second)
Explanation:
This defines the function
def swap(number1,number2):
This swaps the numbers
number1,number2 = number2,number1
This returns the swapped numbers
return number1, number2
The main begins here
This gets input for first
first = int(input("First: "))
This gets input for second
second = int(input("Second: "))
Print the number before swapping
print("You input the numbers as ",first,"and",second)
This swaps the numbers
first,second= swap(first,second)
This prints the numbers after swapping
print("After swapping\nFirst: ",first,"\nSecond:",second)
Print the two strings in alphabetical order. Assume the strings are lowercase. End with newline. Sample output: capes rabbits import java.util.Scanner: public class OrderStrings { public static void main (String args) { String firstString: String secondString: firstString = "rabbits" secondString = "capes" /*Your solution goes here */ return: } }import java.util.Scanner;public class OrderStrings { public static void main(String[] args) { String firstString; String secondString; firstString = "rabbit"; secondString= "capes"; //String class in java provide string comparison function, use it, and get //your work done may even use brute force i.e using for loop and compare character by // character which will not good for the programming language which already have vast //predefined number of functions if(firstString.compareTo(secondString) < 0){ System.out.println(firstString + " " + secondString); } else{ System.out.println(secondString + " " + firstString); } return; }}
Answer:
Following are the code to the given question:
import java.util.Scanner;//import package
public class OrderStrings // defining a class OrderStrings
{
public static void main(String[] args) //defining a main method
{
Scanner scnr = new Scanner(System.in);//defining a Scanner class object
String firstString;//defining a String variable
String secondString; //defining a String variable
firstString = scnr.next();//input value
secondString = scnr.next();//input value
if (firstString.compareTo(secondString) < 0)//use if to compare sting value
System.out.println(firstString + " " + secondString);//print sting value
else//else block
System.out.println(secondString + " " + firstString);//print sting value
}
}
Output:
rabbits capes
capes rabbits
Explanation:
In this code a class "OrderStrings" is defined inside the class the main method is defined that declares the two string variable that uses the input method to input the string value and after input, it uses the conditional statement. Inside this compareTo method is declared that compare string value and prints the string value.
We have removed
A
balls from a box that contained
N
balls and then put
B
new balls into that box. How many balls does the box contain now?
Constraints
All values in input are integers.
Input
Input is given from Standard Input in the following format: n a b
Output
Print the answer as an integer.
There were [tex]N[/tex] balls but we took [tex]A[/tex] balls out, so there are now [tex]N-A[/tex] balls. We add [tex]B[/tex] balls and now we have [tex]N-A+B[/tex] balls.
The program that computes this (I will use python as language has not been specified is the following):
n, a, b = int(input()), int(input()), int(input())
print(f"There are {n-a+b} balls in the box")
# Hope this helps
Explain the following terms.
a) Explain Final keyword with example. b) Define Static and Instance variables
Answer:
A.
the final keyword is used to denote constants. It can be used with variables, methods, and classes. Once any entity (variable, method or class) is declared final , it can be assigned only once.
B.
Static variables are declared in the same place as instance variables, but with the keyword 'static' before the data type. While instance variables hold values that are associated with an individual object, static variables' values are associated with the class as a whole.
___________ colors come forward and command attention. ______________ colors recede away from our eyes and tend to fall into the background of a design.
Answer:
"Warm; Cool/receding" is the correct answer.
Explanation:
The color temperature would be referred to as summer and winter upon that color wheel, the hottest becoming red/orange as well as the most cooler always being bluish or greenish.A terminology to define the warmth of the color is termed as Warm colors. Warm hues are prominent as well as lively just like reds, oranges, etc.Thus the above is the right answer.
what is the characteristics of computer?dicuss any 5 of them
Answer:
speed
accuracy
diligence
versatility
reliabiility
memory
speed: a computer works with more higher speed compared to humans when performing mathematical calculations
accuracy: computer perform calculations with 100% accuracy
dilligence:a computer can perform calculations with the same consistentcy and accuracy
versatility:refers to the capability of a computer to perform different kind of works with same accuracy and efficiencies
reliability
Answer:
speed
accuracy
diligent
versatile
storage and communication
Definition of digital
Answer:
There are two definitions from
Explanation:
1.) (of signals or data) expressed as series of the digits 0 and 1, typically represented by values of a physical quantity such as voltage or magnetic polarization.
2.) (of a clock or watch) showing the time by means of displayed digits rather than hands or a pointer.
I'm not sure if you meant "Digit". But if you did it would mean numbers or the places where numbers would go.
Hope this helps! (If not so sorry)
Answer:
adjective
1.
(of signals or data) expressed as series of the digits 0 and 1, typically represented by values of a physical quantity such as voltage or magnetic polarization.
relating to, using, or storing data or information in the form of digital signals.
"digital TV"
involving or relating to the use of computer technology.
"the digital revolution"
application of printer
Answer:
In addition, a few modern printers can directly interface to electronic media such as memory cards, or to image capture devices such as digital cameras, scanners; some printers are combined with a scanners and/or fax machines in a single unit, and can function as photocopiers.
Given main(), complete the Car class (in file Car.java) with methods to set and get the purchase price of a car (setPurchasePrice(), getPurchasePrice()), and to output the car's information (printInfo()).
Ex: If the input is:
2011
18000
2018
where 2011 is the car's model year, 18000 is the purchase price, and 2018 is the current year, the output is:
Car's information:
Model year: 2011
Purchase price: 18000
Current value: 5770
Note: printInfo() should use three spaces for indentation.
Answer and Explanation:
public class Main {
int Carmodel;
int Purchaseprice;
int Currentyear;
Public void setPurchasePrice(int Purchaseprice){
this.Purchaseprice=Purchaseprice;
}
Public void getPurchasePrice(){
return Purchaseprice;
}
static void printInfo(int Carmodel int Currentyear ){
this.Carmodel=Carmodel;
this.Currentyear=Currentyear;
System.out.println(getPurchasePrice() Carmodel Currentyear);
}
}
The above java program defines a class that has three methods, a get method that returns purchase price of the object, a set method that sets purchase price of the object, and a print method that print out the information about the car object(model, year, price). The print method also takes arguments and assigns values of the arguments/parameters to the object, then prints all.
Which operating system desktop or mobile is the best
Answer:
bing or alien ware is the best.
Answer:
Your choice, but personally, desktop is better.
Explanation:
Desktop devices have portrait orientations so content can stretch across a screen and often multiple messages or images can live comfortably in such a wide space. Mobile devices are usually used in portrait orientation (and the smaller screens mean that even in landscape mode, horizontal space is limited).
Indicate whether the following actions are the actions of a person who will be a victim, or will not be a victim, of phishing attacks.
Replying to an e-mail requesting your user ID and password Phishing victim Not a phishing victim
Answer:
Phishing Victim
Explanation:
Replying to this email could make you a victim of a phishing scam. Phishing attacks are common challenges on security that internet users are faced with. It could lead to others getting hold of sensitive information like your password or bank details. email is one way the hackers used to get this information. replying to such an email could lead one to an unsecure website where information could be extracted
State two ways of preventing virus attack on a computer.
Answer:
updating the computer and having an anti virus on your computer
What is machine learning
Answer:
machine learning is the ability for computers to develop new skills and algorithms without specific instructions to do so.
what is an RTF file?
Answer:
The Rich Text Format is a proprietary document file format with published specification developed by Microsoft Corporation from 1987 until 2008 for cross-platform document interchange with Microsoft products.
how much is this worth in dollars
Answer:
This is worth 50 dollars.
Explanation:
١ - one
٢ - two
٣ - three
٤ - four
٥ - five
٦ - six
٧ - seven
٨ - eight
٩ - nine
٠ - zero
What you see above is the ten digits in Arabic.
Both 5 (٥) and 0 (٠) appear here, thus representing 50.
Create a function called GetColors that will accept two parameters. These parameters can only be red, blue or yellow. Your function needs to analyze these two colors and determine the color mix. Make sure your function returns the color mix back to where it was called.
Answer:
Explanation:
The following code is written in Java. It creates a GetColors method that takes in the two parameter colors of either red, blue or yellow. It combines those colors and returns the mix of the two colors back to the user. A test case has been used in the main method and the output can be seen in the attached image below.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
System.out.println(GetColors("yellow", "red"));
}
public static String GetColors(String color1, String color2) {
if (color1 == "red") {
if (color2 == "blue") {return "purple";}
else if (color2 == "yellow") {return "orange";}
else {return "red";}
} else if (color1 == "blue") {
if (color2 == "red") {return "purple";}
else if (color2 == "yellow") {return "green";}
else {return "blue";}
} else if (color1 == "yellow") {
if (color2 == "red") {return "orange";}
else if (color2 == "blue") {return "green";}
else {return "yellow";}
} else {
return "Wrong Parameters";
}
}
}
You are having a problem with your Windows computer that is isolated to a single graphics editing program that you use every day in your work. When you described the problem to the customer service support person for this product, she told you that the only fix for it is to edit a key under HKEY-LOCAL_MACHINE\SOFTWARE. She has assured you that this fix will work without causing any problems, but you are wary of doing this. Descript the steps and precautions taken.
Answer:
I'm not a big tech head but I know that creating a restore point is highly recommended for changing anything that you aren't 100% sure about to your computer.
9. Which of the following prefixes which relate to bytes are arranged from the smallest to the largest? a) mega, giga, tera, kilo b) meqa tera, giga, kilo c) kilo, mega, giga, tera d) kilo, giga, mega, tera
Answer:
Explanation:
C
kilo = 1000
mega = 1,000,000
giga = 1 billion = 1 000 000 000
tera = 1 trillion = 1 000 000 000 000
Write a recursive function that calculates the sum 11 22 33 ... nn, given an integer value of nin between 1 and 9. You can write a separate power function in this process and call that power function as needed:
Answer:
The function in Python is as follows:
def sumDig(n):
if n == 1:
return 11
else:
return n*11 + sumDig(n - 1)
Explanation:
This defines the function
def sumDig(n):
This represents the base case (where n = 1)
if n == 1:
The function returns 11, when it gets to the base case
return 11
For every other value of n (n > 1)
else:
This calculates the required sum recursively
return n*11 + sumDig(n - 1)
..............is a piece of hardware used to provide data and instructions to a computer used for interaction and control. *
Output device.
Processing.
input device.
All of above.
Answer:
output
Explanation:
it can be seen and touched
9.18 LAB: Exact change - methods Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is:
Answer:
Explanation:
The following code is written in Java. It asks the user to enter the amount of change needed. This is done as a double since we are dealing with coins and not full dollar values alone. It then makes the necessary calculations to calculate the number of each coin needed and outputs it back to the user. A test case has been provided in the picture below with a sample output.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
int dollars = 1;
double quarters = 0.25;
double dimes = 0.10;
double nickels = 0.05;
double pennies = 0.01;
Scanner in = new Scanner(System.in);
System.out.println("Enter Change Value: ");
double change = in.nextDouble();
int numDollars, numQuarters, numDimes, numNickels, numPennies;
double newChange;
numDollars = (int) (change / dollars);
newChange = change % dollars;
numQuarters = (int) (newChange / quarters);
newChange = newChange % quarters;
numDimes = (int) (newChange / dimes);
newChange = newChange % dimes;
numNickels = (int) (newChange / nickels);
newChange = newChange % nickels + 0.001;
numPennies = (int) (newChange / pennies);
newChange = newChange % pennies;
System.out.println("Minimum Num of Coins needed: ");
if (numDollars != 1) {
System.out.println(numDollars + " Dollars");
} else {
System.out.println(numDollars + " Dollar");
}
if (numQuarters != 1) {
System.out.println(numQuarters + " Quarters");
} else {
System.out.println(numQuarters + " Quarter");
}
if (numDimes != 1) {
System.out.println(numDimes + " Dimes");
} else {
System.out.println(numDimes + " Dime");
}
if (numNickels != 1) {
System.out.println(numNickels + " Nickels");
} else {
System.out.println(numNickels + " Nickel");
}
if (numPennies != 1) {
System.out.println(numPennies + " Pennies");
} else {
System.out.println(numPennies + " Penny");
}
}
}
The program is an illustration of conditional statements
Conditional statements are used to make decisions
The program in C++ where comments are used to explain each line is as follows
#include<iostream>
using namespace std;
int main() {
// This line declare all the variables
int amount, dollar, quarter, dime, nickel, penny;
// This prompts the user for input (i.e. the amount)
cout<<"Amount: ";
//This gets the amount from the user
cin>>amount;
// This checks if the amount is 0 or less
if(amount<=0) {
//This prints "No Change"
cout<<"No Change";
}
//If the amount is greater than 0
else {
// These convert the amount to various coins
dollar = amount/100;
amount = amount%100;
quarter = amount/25;
amount = amount%25;
dime = amount/10;
amount = amount%10;
nickel = amount/5;
penny = amount%5;
// The next lines print the coins
if(dollar>=1) {
if(dollar == 1) {
cout<<dollar<<" dollar\n"; }
else {
cout<<dollar<<" dollars\n"; }
}
if(quarter>=1) {
if(quarter== 1) {
cout<<quarter<<" quarter\n";
}
else {
cout<<quarter<<" quarters\n";
}
}
if(dime>=1) {
if(dime == 1) {
cout<<dime<<" dime\n";
}
else {
cout<<dime<<" dimes\n";
}
}
if(nickel>=1) {
if(nickel == 1) {
cout<<nickel<<" nickel\n";
}
else {
cout<<nickel<<" nickels\n";
}
}
if(penny>=1) {
if(penny == 1) {
cout<<penny<<" penny\n";
}
else {
cout<<penny<<" pennies\n";
}
}
}
return 0;
}
Read more about conditions at:
https://brainly.com/question/15683939
What will MOST likely adversely impact the operations of unpatched traditional programmable-logic controllers, running a back-end LAMP server and OT systems with human-management interfaces that are accessible over the Internet via a web interface?
Answer:
The answer is "Option a and Option f"
Explanation:
The cross-site programming and Server-Side Requests fraud were activities that can have negative effects as these are assaults that directly affect your cloud-based servers via web apps. Although the remainder of an attack could be controlled with these approaches, then they can affect the encryption keys only less.
vacuum tubes produced a large amount of
Answer: suck
Explanation:
sucktion
Select the correct statement(s) regarding 4B5B encoding.
a. 4B5B is used to map four codeword bits into a five bit data word
b. 4B5B information bit rate is 80% of the total (information plus overhead) bit rate
c. 4B5B information bit rate is 20% of the total (information plus overhead) bit rate
d. all statements are correct
Answer:
b. 4B5B information bit rate is 80% of the total information plus overhead bit rate.
Explanation:
4B5B bit rate encoding means there is 80% of the bit rate which included all the information plus the overheads. There is 20% of lack in bit rate due to encoding code words which converts data into smaller bits.
Data representation and interactivity are important aspects of data visualization.
a. True
b. False
Answer:
a. True
Explanation:
Data visualization are defined as the representation of the data and information in graphical way. The data visualization tool uses charts, diagrams, graphs, maps, etc. to represent and visualized the information and understand the patter or trend in the data.
It is an effective way to interact with the user and works likes a form of a visual art.
Thus interactivity and data representations are the two important aspect of the data visualization.
Hence, the answer is true.
Draw a Card. Write a program to simulate drawing a card. Your program will randomly select one card from a deck of 52 playing cards. Your program should display the rank (Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King) and suit (Clubs, Diamonds, Hearts, Spades) of the card. Here is a sample run of the program: in The card you picked is Jack of Heart The program should use at a minimum: sequence, selection, arrays, and random numbers.
Answer:
Explanation:
The following code is written in Java. It is a function that creates a Random object to generate random values, then uses those values to choose a random rank and suit using switch statements. It then saves the rank and suit into a String variable in the correct format and finally prints the card that was picked to the screen. The function was called 4 times in the main method and the output can be seen in the attached image below.
public static void randomCardGenerator() {
Random rand = new Random();
int rank = rand.nextInt(14)+1;
int suit = rand.nextInt(4)+1;
String chosenCard = "";
switch (rank) {
case 1: chosenCard += "Ace"; break;
case 2: chosenCard += "1"; break;
case 3: chosenCard += "2"; break;
case 4: chosenCard += "3"; break;
case 5: chosenCard += "4"; break;
case 6: chosenCard += "5"; break;
case 7: chosenCard += "6"; break;
case 8: chosenCard += "7"; break;
case 9: chosenCard += "8"; break;
case 10: chosenCard += "9"; break;
case 11: chosenCard += "10"; break;
case 12: chosenCard += "Jack"; break;
case 13: chosenCard += "Queen"; break;
case 14: chosenCard += "Kind"; break;
default: System.out.println("Wrong Value");
}
chosenCard += " of ";
switch (suit) {
case 1: chosenCard += "Clubs"; break;
case 2: chosenCard += "Diamonds"; break;
case 3: chosenCard += "Hearts"; break;
case 4: chosenCard += "Spades"; break;
default: System.out.println("Invalid Suit");
}
System.out.println(chosenCard);
}
In C++, objects instantiated on the stack must be returned to program memory through the explicit use of the delete keyword.
a) True
b) False
Answer:
b. False.
Explanation:
Delete function not used to remove data stored on the stack. It is only used to free memory on the heap. The C++ is programming language used to develop operating systems.
What is the default return type of a method in Java language?
A.Void
B.Int
C.None
D.Short
Answer:
The default return data type in function is int
Answer: Option (b)
Explanation:
The default return data type in a function is int. In other words commonly if it is not explicitly mentioned the default return data type of a function by the compiler will be of an integer data type.
If the user does not mention a return data type or parameter type, then C programming language will inevitably make it an int.
mark me brainlist
1. Write the CSS for an id with the following characteristics: fixed position, light grey background color, bold font weight, and 10 pixels of padding
Answer:
#element
{
position: fixed;
background-color: RGBA(211, 211, 211, 1);
font-weight: bold;
padding: 10px;
}
Code an operation class called ArrayComputing that will ask user to enter a serials of integers with a loop until -99 is entered and after the input it will keep and display the greatest, the least, the sum and the average of the data entries (-99 is not counted as the data). And code a driver class called ArrayComputingApp to run and test the ArrayComputing class, separately.
Must use required/meaningful names for fields, variables, methods and classes.
Must use separate methods to perform each of specified tasks as described.
Must document each of your source code
Answer:
Explanation:
The following is written in Java and creates the ArrayComputing class. It uses the constructor to create the infinite loop that only breaks when the user enters a -99. After every input number it goes adding the correct values to the variables. Once it is done the user can call any of the getter methods to get the variable values as well as calculate the average.
import java.util.Scanner;
class ArrayComputingApp {
public static void main(String[] args) {
ArrayComputing arrayComputing = new ArrayComputing();
System.out.println("Average: " + arrayComputing.getAverage());
System.out.println("Greatest: " + arrayComputing.getGreatest());
System.out.println("Least: " + arrayComputing.getLeast());
System.out.println("Sum: " + arrayComputing.getSum());
}
}
class ArrayComputing {
int greatest, least, sum, average;
int count = 0;
Scanner in = new Scanner(System.in);
public ArrayComputing() {
while (true) {
System.out.println("Enter a number or -99 to exit: ");
int num = in.nextInt();
if (num == -99) {
break;
}
if (num > this.greatest) {
this.greatest = num;
}
if (this.count == 0) {
this.least = num;
} else {
if (num < this.least) {
this.least = num;
}
}
this.sum += num;
this.count += 1;
}
}
public int getAverage() {
this.average = sum / count;
return this.average;
}
public int getGreatest() {
return greatest;
}
public int getLeast() {
return least;
}
public int getSum() {
return sum;
}
}
Assume that an O(log2N) algorithm runs for 10 milliseconds when the input size (N) is 32. What input size makes the algorithm run for 14 milliseconds
Answer:
An input size of N = 128 makes the algorithm run for 14 milliseconds
Explanation:
O(log2N)
This means that the running time for an algorithm of length N is given by:
[tex]F(N) = c\log_{2}{N}[/tex]
In which C is a constant.
Runs for 10 milliseconds when the input size (N) is 32.
This means that [tex]F(32) = 10[/tex]
So
[tex]F(N) = c\log_{2}{N}[/tex]
[tex]10 = c\log_{2}{32}[/tex]
Since [tex]2^5 = 32, \log_{2}{32} = 5[/tex]
Then
[tex]5c = 10[/tex]
[tex]c = \frac{10}{5}[/tex]
[tex]c = 2[/tex]
Thus:
[tex]F(N) = 2\log_{2}{N}[/tex]
What input size makes the algorithm run for 14 milliseconds
N for which [tex]F(N) = 14[/tex]. So
[tex]F(N) = 2\log_{2}{N}[/tex]
[tex]14 = 2\log_{2}{N}[/tex]
[tex]\log_{2}{N} = 7[/tex]
[tex]2^{\log_{2}{N}} = 2^7[/tex]
[tex]N = 128[/tex]
An input size of N = 128 makes the algorithm run for 14 milliseconds