Answer:
Explanation:
The following program is written in Java and creates three levels with the different set of randomly generated arithmetic problems. As the player goes getting more points they advance every 5 points to the next level.
import java.util.Random;
import java.util.Scanner;
class Main {
private static Random random = new Random();
private static Scanner in = new Scanner(System.in);
static int points = 0;
public static void main(String[] args) {
while (true) {
System.out.println(points);
if (points < 5) {
System.out.println("Starting Level 1");
levelOne();
} else if (points < 10) {
System.out.println("Starting Level 2");
levelTwo();
} else if (points < 15) {
System.out.println("Starting Level 3");
levelThree();
}
}
}
public static boolean levelOne() {
int numberOne = random.nextInt(10);
int numberTwo = random.nextInt((10 - numberOne));
int answer = numberOne + numberTwo;
int count = 0;
while (points < 5 && count < 2) {
System.out.println("What is " + numberOne + " + " + numberTwo + "?: ");
int userChoice = in.nextInt();
if (userChoice == answer) {
points += 1;
levelOne();
} else {
count += 1;
}
}
return false;
}
public static boolean levelTwo() {
int numberOne = random.nextInt(10);
int numberTwo = random.nextInt(10);
int answer = numberOne + numberTwo;
int count = 0;
while (points < 10 && count < 2) {
System.out.println("What is " + numberOne + " + " + numberTwo + "?: ");
int userChoice = in.nextInt();
if (userChoice == answer) {
points += 1;
levelTwo();
} else {
count += 1;
}
}
return false;
}
public static boolean levelThree() {
int numberOne = random.nextInt(10);
int numberTwo = random.nextInt(10);
int answer = numberOne - numberTwo;
int count = 0;
if (answer <= 0) {
levelThree();
}
while (points < 15 && count < 2) {
System.out.println("What is " + numberOne + " - " + numberTwo + "?: ");
int userChoice = in.nextInt();
if (userChoice == answer) {
points += 1;
levelThree();
} else {
count += 1;
}
}
return false;
}
}
1. How important is e-mail communication to you? Why?
Answer:
Communicating by email is almost instantaneous, which enhances communications by quickly disseminating information and providing fast response to customer inquiries. It also allows for quicker problem-solving and more streamlined business processes.
Explain why programming languages evolve?
Answer:
Throughout the 20th century, research in compiler theory led to the creation of high-level programming languages, which use a more accessible syntax to communicate instructions. The first high-level programming language was Plankalkül, created by Konrad Zuse between 1942 and 1945.
please give brainliest
Under which menu option of a word processing program does a star appear?
A star appears under the
menu of the word processing program.
Answer:
shapes
Explanation:
Plato got it correctly
Find the distance between the points.
(5,-2),(-6,-2)
Answer:
-24
Explanation:
because
3(-6 -2) then
3×(-8) > -24
Write a statement that takes a variable named file_object that contains a file object and reads its contents into a Python list of lines. Store the resulting list into a variable named file_contents.Write a statement that takes a variable named file_object that contains a file object and reads its contents into a Python list of lines. Store the resulting list into a variable named file_contents.
Answer:
Answered below
Explanation:
#file is first opened and saved into file_object variable.
file_object = open('new_file.txt', 'r')
file_contents = file_object.readlines()
#the readlines() reads the contents of the file, line by line and returns a list of lines. Therefore, file_contents contains a list of lines read from file object and can be iterated over to get each line.
Which of the following statements is false?
Copyright exists the moment a work is created.
Copyright protects intellectual property such as text, art, film, music, or software.
Omitting the © copyright symbol means your work is not copyrighted.
Copyright is free.
You are not required to register your copyright.
It is false that omitting the © copyright symbol means your work is not copyrighted. The correct option is C.
What is a copyright?Original works of authorship are protected by copyright, a type of intellectual property, as soon as the author fixes the work in a tangible form of expression.
The creators of the works of expression typically control the copyrights, however there are some significant exceptions: When an employee produces a work while employed, the employer is the rightful owner of the copyright.
Some individuals think that a work isn't covered by copyright law if it doesn't display a copyright emblem. That is untrue. The copyright symbol need not be used in most situations.
Thus, the correct option is C.
For more details regarding a copyright, visit:
https://brainly.com/question/14704862
#SPJ2
what are the importance of web browser
Answer:
Web browser helps to access www.
Explanation:
A web browser is a software program that acts as a person's portal and portal to the Internet. It's easy to forget the browser's value now that it's so popular in our everyday lives. Users had to download software only to talk, watch videos, or play music until web browsers were invented.
1. Add the following method to the Point class:
public double distance(Point other)
Returns the distance between the current Point object and the given other Point object. The distance between two points is equal to the square root of the sum of the squares of the differences of their x- and y-coordinates. In other words, the distance between two points (x1, y1) and (x2, y2) can be expressed as the square root of (x2 - x1)2 + (y2 - y1)2. Two points with the same (x, y) coordinates should return a distance of 0.0.
public class Point {
int x;
int y;
// your code goes here
}
2. Create a class called Name that represents a person's name. The class should have fields named firstName representing the person's first name, lastName representing their last name, and middleInitial representing their middle initial (a single character). Your class should contain only fields for now.
3. Add two new methods to the Name class:
public String getNormalOrder()
Returns the person's name in normal order, with the first name followed by the middle initial and last name. For example, if the first name is "John", the middle initial is 'Q', and the last name is "Public", this method returns "John Q. Public".
public String getReverseOrder()
Returns the person's name in reverse order, with the last name preceding the first name and middle initial. For example, if the first name is "John", the middle initial is 'Q', and the last name is "Public", this method returns "Public, John Q.".
4. Add the following method to the Point class:
public int quadrant()
Returns which quadrant of the x/y plane this Point object falls in. Quadrant 1 contains all points whose x and y values are both positive. Quadrant 2 contains all points with negative x but positive y. Quadrant 3 contains all points with negative x and y values. Quadrant 4 contains all points with positive x but negative y. If the point lies directly on the x and/or y axis, return 0.
public class Point {
private int x;
private int y;
// your code goes here
}
Answer:
Explanation:
The following code is written in Java and creates all of the methods that were requested in the question. There is no main method in any of these classes so they will have to be called from the main method and call one of the objects created method for the code to be tested. (I have tested it and it is working perfectly.)
class Point {
private int x, y;
public void Point(int x, int y) {
this.x = x;
this.y = y;
}
public double distance (Point other) {
double distance = Math.sqrt(Math.pow((other.x - this.x), 2) + Math.pow((other.y - this.y), 2));
return distance;
}
public int quadrant() {
if (this.x > 0 && this.y > 0) {
return 1;
} else if (this.x < 0 && this.y > 0) {
return 2;
} else if (this.x < 0 && this.y < 0) {
return 3;
} else if (this.x > 0 && this.y < 0) {
return 4;
} else {
return 0;
}
}
}
class Name {
String firstName, lastName;
char middleInitial;
public String getNormalOrder() {
String fullName = firstName + " " + middleInitial + " " + lastName;
return fullName;
}
public String getReverseOrder() {
String fullName = lastName + ", " + firstName + " " + middleInitial;
return fullName;
}
}
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout << fixed << setprecision(2); once before all other cout statements.
Answer:
Explanation:
The following is written in C++ and asks the user for inputs in both miles/gallon and dollars/gallon and then calculates the gas cost for the requested mileages using the input values
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
// distance in miles
float distance1 = 20.0, distance2 = 75.0, distance3 = 500.0;
float miles_gallon, dollars_gallon;
cout << "Enter cars miles/gallon: "; cin >> miles_gallon;
cout << "Enter cars dollars/gallon: "; cin >> dollars_gallon;
cout << "the gas cost for " << distance1 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance1 / miles_gallon << "$\n";
cout << "the gas cost for " << distance2 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance2 / miles_gallon << "$\n";
cout << "the gas cost for " << distance3 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance3 / miles_gallon << "$\n";
return 0;
}
. Which of these perform real-world activities such as eating, sleeping, walking, and running in virtual worlds?
Answer:
all
Explanation:
Answer:
avatars
Explanation: I just took the test
Which option in a Task element within Outlook indicates that the task is scheduled and will be completed on a later
date?
O Waiting on someone else
O In Progress
O Not started
O Deferred
Answer: D: Deferred
Explanation:
took test
A colleague has written a section of the main body of the same financial report. He has a long paragraph with lots of numbers. You suggest that he make this section easier to read by adding _____.
graphics
a reference
columns
a table
Answer:
a table
Explanation:
Answer: a table
Explanation:
Assume the data link protocol used by NDAS has the following associated characteristics:
An 8-bit ASCII code is used. Each frame has a size (length) of 11936 bits. A half-duplex circuit with a speed of 1 million bits per second is used for transmission. There is a 30-millisecond turnaround time on the half-duplex circuit. Each frame contains 20 overhead (non-user-data) bytes. Assume that the probability of a frame requiring retransmission due to error in transmission is 1 percent. A millisecond is one-thousandth of a second. Also, 8 bits = 1 character = 1byte
Fill in the blanks
K= _________ bits per bytes
M=_________ bytes
C= _________ overhead bytes
Answer:
The transmission speed = 0.278 MB/s
Explanation:
K = 8 bits
M = 11936/8 bits = 1492 bits
transmission rate R = 1000000/ 8 = 125000 bps
overhead bytes C = 20
probability = 0.01
time T = 30 ms = 30 x10^-3 s
The data transmission speed formula = K(M-C)(1-p) / (M/R) + T
= 8( 1492 - 20)(0.99)/ (1492/125000) + 30 x10^-3
= 0.278 MB/s
What is the New York Times doing to try to keep up with digital technology?
Answer:
Clover Food Labs: Using Technology to Bring The “Real Food” Movement to Cambridge, ... The New York Times is one of the many companies that has had its existence ... That monthly limit has since been reduced to 10 articles in an attempt to ... which has at least kept pace with the limited expectations for the industry
Print person1's kids, call the incNumKids() method, and print again, outputting text as below. End each line with a newline.
Sample output for below program with input 3:
Kids: 3
New baby, kids now: 4
// ===== Code from file PersonInfo.java =====
public class PersonInfo {
private int numKids;
public void setNumKids(int setPersonsKids) {
numKids = setPersonsKids;
}
public void incNumKids() {
numKids = numKids + 1;
}
public int getNumKids() {
return numKids;
}
}
// ===== end =====
// ===== Code from file CallPersonInfo.java =====
import java.util.Scanner;
public class CallPersonInfo {
public static void main(String [] args) {
Scanner scnr = new Scanner(System.in);
PersonInfo person1 = new PersonInfo();
int personsKid;
personsKid = scnr.nextInt();
person1.setNumKids(personsKid);
/* Your solution goes here */
}
}
// ===== end =====
Answer:
Explanation:
The following code was written in Java and modifies the code so that for the given input such as 3 it outputs the exact information shown in the sample output.
import java.util.Scanner;
class CallPersonInfo {
public static void main(String [] args) {
Scanner scnr = new Scanner(System.in);
PersonInfo person1 = new PersonInfo();
int personsKid;
System.out.println("How many kids do you have:");
personsKid = scnr.nextInt();
person1.setNumKids(personsKid);
/* Your solution goes here */
System.out.println("Kids: " + person1.getNumKids());
person1.incNumKids();
System.out.println("New Baby, kids now: " + person1.getNumKids());
}
}
class PersonInfo {
private int numKids;
public void setNumKids(int setPersonsKids) {
numKids = setPersonsKids;
}
public void incNumKids() {
numKids = numKids + 1;
}
public int getNumKids() {
return numKids;
}
}
Give me good answers
1- what is the money?
2- what is the wealth?
How can it be used for good
Answer:
Money is currency
Explanation:
Is is how you pay for items
Consider any tasks performed in real life, for example, driving a taxi. The task you pick involves many functions. Driving a taxi involves picking up customers, and quickly and safely transporting them to their destination. Go through the components of the AI cycle to automate the problem you choose. List the useful precepts available. Describe how you will represent your knowledge. Based on that, describe how you will use reasoning to make and execute a plan expected to achieve a goal or obtain maximum utility. (this is for artificial intelligence, but they did not have that option)
Write a program that would determine the day number in a non-leap year. For example, in a non-leap year, the day number for Dec 31 is 365; for Jan 1 is 1, and for February 1 is 32. This program will ask the user to input day and month values. Then it will display the day number day number corresponding to the day and month values entered assuming a non-leap year. (See part II to this exercise below).
Answer:
In Python:
months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]
day = int(input("Day: "))
month = input("Month: ")
ind = months.index(month)
numday = 0
for i in range(ind):
numday+=daymonths[i]
numday+=day
print(numday)
Explanation:
This initializes the months to a list
months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
This initializes the corresponding days of each month to a list
daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]
This gets the day from the user
day = int(input("Day: "))
This gets the month from the user
month = input("Month: ")
This gets the index of the month entered by the user
ind = months.index(month)
This initializes the sum of days to 0
numday = 0
This adds up the days of the months before the month entered by the user
for i in range(ind):
numday+=daymonths[i]
This adds the day number to the sum of the months
numday+=day
This prints the required number of days
print(numday)
Note that: Error checking is not done in this program
In the QuickSort algorithm, the partition method we developed in class chose the start position for the pivot. We saw that this leads to worst case performance, O(n2), when the list is initially sorted. Try to improve your QuickSort by choosing the value at the middle, instead of the value at the start, for the pivot. Test your solution with the Driver you used for homework. Upload the output produced by the Driver, and your modified QuickSort source file.
====================================================
ORIGINAL
public class QuickSort> implements Sorter
{
List list;
public void sort(List list)
{
this.list = list;
qSort(0, list.size() -1);
}
public void qSort(int start, int end)
{
if(start >= end)
return;
int p = partition(start,end);
qSort(start, p-1);
qSort(p+1,end);
}
public int partition(int start,int end)
{
int p = start;
E pivot = list.get(p);
for(int i = start+1; i <= end; i++)
if(pivot.compareTo(list.get(i)) > 0)
{
list.set(p, list.get(i));
p++;
list.set(i,list.get(p));
}
list.set(p,pivot);
return p;
}
}
====================================================
Driver
public class DriverQuicksort
{ static final int MAX = 20;
public static void main(String[] args)
{
Random rand = new Random(); // random number generator
List numbers = new ArrayList ();
Sorter sorter;
sorter = new QuickSort ();
// Test QuickSort with random input
System.out.println ("Testing Quicksort");
for (int i=0; i
numbers.add (rand.nextInt(50)); // random int in [0..49]
System.out.println ("Before sorting:");
System.out.println (numbers);
sorter.sort (numbers );
System.out.println ("After sorting:");
System.out.println (numbers);
System.out.println ();
// Test QuickSort with ascending input
numbers.clear();
for (int i=0; i
numbers.add (i * 10); // initially in ascending order
System.out.println ("Before sorting:");
System.out.println (numbers);
sorter.sort ( numbers);
System.out.println ("After sorting:");
System.out.println (numbers);
System.out.println ();
// Test QuickSort with descendng input
numbers.clear();
for (int i=0; i
numbers.add (MAX-i); // initially in ascending order
System.out.println ("Before sorting:");
System.out.println (numbers);
sorter.sort ( numbers);
System.out.println ("After sorting:");
System.out.println (numbers);
System.out.println ();
numbers.clear();
numbers.add(75);
numbers.add(93);
numbers.add(35);
numbers.add(0);
numbers.add(75);
numbers.add(-2);
numbers.add(93);
numbers.add(4);
numbers.add(6);
numbers.add(76);
System.out.println ("Before sorting:");
System.out.println (numbers);
sorter.sort(numbers);
System.out.println ("After sorting:");
System.out.println (numbers);
System.out.println ();
}
}
For her homework, Annie has added the picture of a fruit in a document. She wants to enhance it to give a cut-out look. Which feature or menu option should she use?
Answer: See explanation
Explanation:
Since we are given the information that Annie added the picture of a fruit in a document and wants to enhance it to give a cut-out, she can enhance her document's look by using clip art.
Clips art are simply used for designing and can be used in the illustration of a medium. In this case, the clip art can like a bitmap graphics which typically have a limited quality.
Answer:
Shapes
Explanation:
took the quiz
Kevin is a DJ and has a passion for creating and modifying audio tracks. Which application software facilitates him in his passion?
A.
presentation software
B.
multimedia software
C.
word processing software
D.
spreadsheet software
You can Hyperlink by:
Question 5 options:
Press CTRL+K (shortcut)
Go to Insert tab, Link Group, Click on Link Icon
Right click on a word / shape / picture and choose Link
All of the above /
Answer:
All of the above
Explanation:
I tryed them all
A video game character can face toward one of four directions: north, south, east, and west. Each direction is stored in memory as a sequence of four bits. A new version of the game is created in which the character can face toward one of eight directions, adding northwest, northeast, southwest, and southeast to the original four possibilities. Which of the following statements is true about how the eight directions must be stored in memory?
A. Four bits are not enough to store the eight directions. Five bits are needed for the new version of the game.
B. Four bits are enough to store the eight directions
C. Four bits are not enough to store the eight directions. Sodeen bits are needed for the new version of the game.
D. Four bits are not enough to store the eight directions. Eight bits are needed for the new version of the game.
Answer:
B. Four bits are enough to store the eight directions
Explanation:
The summary of the question is to determine whether 4 bits can store 8 directions or not.
To understand this question properly, the 8 bits will be seen as 8 different characters.
In computer memory, a computer of n bits can store 2^n characters.
In this case:
[tex]n = 4[/tex] i.e. 4 bits
So:
[tex]2^n = 2^4[/tex]
[tex]2^n = 16[/tex]
This implies that the memory can store up to 16 characters.
Because 16 > 8, then (b) answers the question.
U $ er Ideas for R 0 B 1 0 X?
Answer:
umm huh
Explanation:
english please
Answer:
i play ro blox add me wwekane9365
Explanation:
Consider the following code segment, which is intended to create and initialize the two-dimensional (2D) integer array num so that columns with an even index will contain only even integers and columns with an odd index will contain only odd integers.
int[][] num = /* missing code */;
Which of the following initializer lists could replace /* missing code */ so that the code segment will work as intended?
A. {{0, 1, 2}, {4, 5, 6}, {8, 3, 6}}
B. {{1, 2, 3}, {3, 4, 5}, {5, 6, 7}}
C. {{1, 3, 5}, {2, 4, 6}, {3, 5, 7}}
D. {{2, 1, 4}, {5, 2, 3}, {2, 7, 6}}
E. {{2, 4, 6}, {1, 3, 5}, {6, 4, 2}}
Answer:
A. {{0, 1, 2}, {4, 5, 6}, {8, 3, 6}}
Explanation:
From the options, we can see that the array is a 3 by 3 array and the array index (whether row or column) begins at 0.
So, the column index for this array is 0, 1 and 2.
Column number 0 and 2 will be treated as the even column while column number 1 will be treated as the odd columns.
Of all options (a) to (e), option (a) fits the requirement of the question; hence; (a) answers the question.
Answer:
A
Explanation:
because the index is even
How many people has the largest cyber attack killed?
Answer:
I think it's MyDoom?? I heard it's the most dangerous cyber attack in history since it caused 38 billion dollars.
Write a Python program (rainfall.py) to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. Then for each year, the program should ask twelve times, once for each month, for inches of rainfall for that month. At the end, , the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
Your program should contain two functions:
(1) rainfall(year): This function takes in a year (integer) as a parameter, and returns two values (totalMonths and totalRainfall). In this function, you need to use nested loop. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for inches (float) of rainfall for that month. After all iterations, the function should return the number of months (totalMonths) and the total inches of rainfall (totalRainfall). (Submit for 4 points)
(2) __main__: In the main, you do the following: (Submit for 6 points)
a. Prompt the user to input the number of years. Reprompt the user if the number of years is 0 or less. Hint: use a while loop.
b. Call rainfall(year) and pass to it the value entered above.
c. Calculate the average based on the returned values from rainfall function.
d. Display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
Answer:
def rainfall(year):
totalMonths = totalRainfall = 0
for y in range(year):
for month in range(12):
rainfall = float(input(f"Enter inches of rainfall for month #{month+1}: "))
totalRainfall += rainfall
totalMonths = year * 12
return totalMonths, totalRainfall
def __main__():
while True:
year = int(input("Enter the number of years: "))
if year > 0:
break
numberOfMonths, totalRainfall = rainfall(year)
averageRainFall = totalRainfall / numberOfMonths
print(f"\nTotal number of months: {numberOfMonths}")
print(f"The total inches of rainfall: {totalRainfall}")
print(f"The average rainfall per month for the entire period: {averageRainFall}")
if __name__ == '__main__':
__main__()
Explanation:
Create a function named rainfall that takes year as a parameter
Inside the function:
Create a nested for loop. The outer loop iterates for each year (The range is from 0 to year-1) and the inner loop iterates for each month of that year (The range is from 0 to 11). Inside the inner loop, ask the user to enter the rainfall for that month. Add the rainfall to the totalRainfall (cumulative sum)
When the loops are done, calculate the totalMonths, multiply year by 12
Return the totalMonths and totalRainfall
Inside the main:
Create a while loop that asks user to enter the number of years while it is greater than 0
Call the rainfall function, passing the year as parameter. Set the numberOfMonths and totalRainfall using the rainfall function
Calculate the averageRainFall, divide totalRainfall by numberOfMonths
Print the results
Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:
101
133
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, srand() has already been called; do not call srand() again.
Code:
#include
#include // Enables use of rand()
#include // Enables use of time()
using namespace std;
int main() {
int seedVal = 0;
seedVal = 4;
srand(seedVal);
/* Your solution goes here */
return 0;
}
Answer:
Replace the comment with:
cout<<100 + rand() % 49<<endl;
cout<<100 + rand() % 49<<endl;
Explanation:
To generate random number from min to max, we make of the following syntax:
min + rand()%(max - min)
In this case:
[tex]min = 100[/tex]
[tex]max = 149[/tex]
So, we have:
100 + rand()%(149 - 100)
100 + rand()%49
To print the statements, make use of:
cout<<100 + rand() % 49<<endl;
cout<<100 + rand() % 49<<endl;
what is the difference between the flip horizontal and the flip vertical option
Answer:
Flip horizontal: Flip around the vertical axis. Flip vertical: Flip around the horizontal axis.
Explanation:
hope this helps
Libby’s keyboard is not working properly, but she wants to select options and commands from the screen itself. Which peripheral device should she use?
A.
voice recognition
B.
microphone
C.
mouse
D.
compact disk