2.28 LAB: Simple statistics
Part 1
Given 4 integers, output their product and their average using integer arithmetic.

Ex: If the input is:

8 10 5 4
the output is:

1600 6
Note: Integer division discards the fraction. Hence the average of 8 10 5 4 is output as 6, not 6.75.

Note: The test cases include four very large input values whose product results in overflow. You do not need to do anything special, but just observe that the output does not represent the correct product (in fact, four positive numbers yield a negative output; wow).

Submit the above for grading. Your program will fail the last test cases (which is expected), until you complete part 2 below.

Part 2
Also output the product and average using floating-point arithmetic.

Output each floating-point value with three digits after the decimal point, which can be achieved by executing
cout << fixed << setprecision(3); once before all other cout statements.

Hint: Convert the input values from int to double.

Ex: If the input is:

8 10 5 4
the output is:

1600 6
1600.000 6.750

Answers

Answer 1

The task requires writing a prοgram that takes 4 integers as input and οutputs their prοduct and average using bοth integer and flοating-pοint arithmetic.

Define integer arithmetic.

Arithmetic integers are a subset οf the set οf integers, which includes all whοle numbers and their negative cοunterparts. Specifically, arithmetic integers include all nοn-negative integers (0, 1, 2, 3, ...) and their negative cοunterparts (0, -1, -2, -3, ...), but exclude all fractiοns, decimals, and irratiοnal numbers.

Arithmetic integers are used in a variety οf mathematical οperatiοns and are the building blοcks οf algebraic expressiοns and equatiοns. They are alsο used in number theοry, cryptοgraphy, and οther areas οf mathematics.

Part 1

#include <iοstream>

using namespace std;

int main() {  

  int num1, num2, num3, num4;

 

  cin >> num1 >> num2 >> num3 >> num4;

 

  int product = num1 * num2 * num3 * num4;

  int average = (num1 + num2 + num3 + num4) / 4;

 

  cout << product << " " << average << endl;

  return 0;

}

Part 2

#include <iostream>

#include <iomanip>

using namespace std;

int main() {

  int num1, num2, num3, num4;

 

  cin >> num1 >> num2 >> num3 >> num4;

 

  int product = num1 * num2 * num3 * num4;

  int average = (num1 + num2 + num3 + num4) / 4;

 

  double product_float = static_cast<double>(num1 * num2 * num3 * num4);

  double average_float = (num1 + num2 + num3 + num4) / 4.0;

 

  cout << product << " " << average << endl;

 

  cout << fixed << setprecision(3);

  cout << product_float << " " << average_float << endl;

  return 0;

}

To learn more about integers click here

https://brainly.com/question/15276410

#SPJ1


Related Questions

Write a C++ program that displays the total running time of a given algorithm based on
different situations such as processor speed, input size, processor load, and software
environment (DOS and Windows).

Answers

Answer: Your welcome!

Explanation:

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

 int processorSpeed; //in MHz

 int inputSize; //in Kb

 int processorLoad; //in %

 int softwareEnvironment; //1: DOS, 2: Windows

 int runningTime; //in ms

 

 cout << "Enter processor speed (MHz): ";

 cin >> processorSpeed;

 

 cout << "Enter input size (Kb): ";

 cin >> inputSize;

 

 cout << "Enter processor load (%): ";

 cin >> processorLoad;

 

 cout << "Enter software environment (1-DOS, 2-Windows): ";

 cin >> softwareEnvironment;

 

 if(softwareEnvironment == 1)

 {

   //DOS running time calculation

   runningTime = (inputSize / processorSpeed) + (processorLoad / 10);

 }

 else

 {

   //Windows running time calculation

   runningTime = (inputSize / (processorSpeed/2)) + (processorLoad / 10);

 }

 

 cout << "Total running time: " << runningTime << "ms" << endl;

 

 return 0;

}

compare and contrast the school of digital age and that of industrial age

Answers

The school of digital age represents a significant departure from the school of the industrial age.

Compare the digital age and industrial age schools?

The school of the digital age and the school of the industrial age differ in several ways.

Curriculum and teaching methods: The school of the industrial age focused on rote learning, memorization, and standardized testing. The curriculum was based on a set of core subjects, such as reading, writing, math, and science. In contrast, the school of the digital age emphasizes problem-solving, critical thinking, creativity, collaboration, and digital literacy. The curriculum is often personalized, interdisciplinary, and project-based. The teaching methods include online learning, blended learning, flipped classroom, and adaptive learning.

Technology and resources: The school of the industrial age used traditional resources, such as textbooks, chalkboards, and pencils. Technology was not a major part of the learning environment. In contrast, the school of the digital age relies heavily on technology, such as laptops, tablets, smartphones, and educational software. Technology is seen as a tool to enhance learning, engage students, and prepare them for the digital world.

Teacher's role: In the school of the industrial age, the teacher was the primary source of knowledge and authority. The teacher lectured and imparted information to the students. The students were expected to listen, memorize, and regurgitate the information. In contrast, the school of the digital age emphasizes the teacher's role as a facilitator, coach, and guide. The teacher creates a supportive and engaging learning environment that allows students to explore, experiment, and discover knowledge.

Learning outcomes: The school of the industrial age focused on preparing students for factory work and a standardized society. The emphasis was on discipline, obedience, and conformity. In contrast, the school of the digital age aims to prepare students for a complex, diverse, and rapidly changing world. The emphasis is on creativity, innovation, and adaptability. The goal is to develop lifelong learners who can learn, unlearn, and relearn.

In summary, The school of the digital age places greater emphasis on digital literacy, critical thinking, collaboration, and creativity, and seeks to prepare students for a rapidly changing world.

To learn more about school of digital age, visit: https://brainly.com/question/30921786

#SPJ1


Write a program using integers user_num and x as input, and output user_num divided by x three times.

Answers

Answer:

user_num = int(input("Enter an integer: "))

x = int(input("Enter another integer: "))

result = user_num / x

print(result)

result = result / x

print(result)

result = result / x

print(result)

Explanation:

Okay so when you run the program, it will ask you to enter two integers (user_num and x), and then it will output the result of dividing user_num by x three times, as specified in the question.

For questions 5-8, consider the following code:



def mystery(a = 2, b = 1, c = 3):

return 2 * a + b + 3 * c

What is the output for mystery(4, 3, 7)?

What is the output for mystery(5, 8)?

What is the output for mystery(1)?

What is the output for mystery()?

Answers

Answer:

les go, it has optional parameters so...

Explanation:

output of 1 is 32

second 27

third 12

fourth 14

A team of engineers have done the root cause analysis of all identified defects of Release 1. To prevent such defects occurring in the next release, they have proposed a few changes to the process.

Answers

The team of engineers have conducted a root cause analysis of all identified defects in Release 1. They have proposed process changes to prevent these defects from occurring in the next release.

What is an engineer?

An engineer is a professional who applies scientific, mathematical, and technical knowledge to design, develop, and improve products, systems, and processes. Engineers use their knowledge and skills to solve practical problems and meet the needs of society.

What is root cause?

A root cause is the fundamental reason or underlying factor that leads to a problem or issue. Identifying the root cause is important for developing effective solutions and preventing the problem from occurring again.

To know more about engineer's analysis visit:

https://brainly.com/question/19819958

#SPJ9

What type of projects can I find in Workana?
A) Free projects
B) Paid projects in which I can charge per hour worked or by finished project
C) Projects paid by commission
D) Projects in which I can partner with other users and share profits
E) All of the above

Answers

Answer:

E

Explanation:

When you are looking for projects at Workana or post a project, you can work o post a project for a fixed price or hourly.

Let's see the differences

Fixed Price:

Fixed prices are the projects that are well defined with the reach and job structure and the payment will be realized once at the end of the job. The customer and professional agreed price before starting working on the project. It's important to measure the specific goals for both sides. As soon as the job goes on, some deliverables will define the progress of the job. It's crucial to keep clear the reach, time and deliverables before starting work on the project. In this way, you can avoid miscommunication.

On the other hand, if it is not clear what is expected on the project that you applying for,  some changes are suddenly expected on the project that you are already working on, or even if you must dedicate a large part of your week/month in this project, then it is recommended that you be hired in a more flexible way.

Projects by Hour

In these cases above the best choice are jobs by hour. Both customer and professional agreed on a price per hour and starts working on the project reporting the hours that were worked on through Workana.

Customers can accept or reject the report and have perfect control over the job that is being realized. Also, it can limit the authorized hours that a professional can work on his project. Doesn't matter if the job is a fixed price or per hour, be sure that all is well accorded and the objectives are clear to achieve success for both sides.

As both agree before starting, less misunderstanding they will have.

Remember that fixed-price projects always have Workana's guarantee.

And the guarantee on projects by the hour is valid only if the hours are registered by Workana Time Report.

The money will be released only when the project is totally finished according to the initial deal.

LensForAll is a company that sells affordable contact lenses on its website. The CEO of the company realizes that an app must be developed that would allow customers to virtually try on colored lenses to find out what best suits them. Which of these features should the app have
Hey it should be a portable app so that it is quick to use B it should have responsive design so that it is easy to use on mobile devices see it should be a part of a productivity Suite so uterus can multitask or D is should be a local app so that users are installed

Answers

Of the options provided, the feature that the app should have to allow customers to virtually try on colored lenses is:

B) It should have responsive design so that it is easy to use on mobile devices.

Explanation:

The app should be easy to use on mobile devices since it is likely that many customers will use the app on their smartphones or tablets. A responsive design would allow the app to adapt to different screen sizes and orientations, making it user-friendly for customers regardless of the device they are using. This feature is directly related to the specific requirement of allowing customers to virtually try on colored lenses.

what is lenses ?

Lenses are optical devices that are used to bend and focus light. They are typically made of transparent materials, such as glass or plastic, and can be used in a wide range of applications, from eyeglasses and camera lenses to telescopes and microscopes.

To know more about LensForAll, visit:

https://brainly.com/question/25288296

#SPJ9

Add the function min as an abstract function to the class arrayListType to return the smallest element of the list.

Also, write the definition of the function min in the class unorderedArrayListType and write a program to test this function.

part 3

MY Main


//Data: 18 42 78 22 42 5 42 57

#include
#include "arrayListType.h"
#include "unorderedArrayListType.h"
using namespace std;
int main()
{
unorderedArrayListType intList(25);
int number;
cout << "";
for(int i = 0;i < 8; i++)
{
cin >> number;
intList.insertEnd(number);
}
cout << endl;
intList.print();
cout << endl;

//Testing for min
cout << "The smallest number in intList: "
<< intList.min() << endl;

return 0;
}

Answers

Answer:

Here is the updated code for the `arrayListType` class with the abstract function `min` added:

```cpp

class arrayListType

{

public:

virtual int min() const = 0;

//other member functions

};

```

And here is the implementation of the `min` function in the `unorderedArrayListType` class:

```cpp

class unorderedArrayListType : public arrayListType

{

public:

int min() const override

{

int minVal = list[0];

for (int i = 1; i < length; i++) {

if (list[i] < minVal) {

minVal = list[i];

}

}

return minVal;

}

//other member functions

};

```

And here's an example program that uses the `min` function:

```cpp

#include <iostream>

#include "arrayListType.h"

#include "unorderedArrayListType.h"

using namespace std;

int main()

{

unorderedArrayListType intList(25);

int number;

cout << "Enter 8 integers: ";

for(int i = 0; i < 8; i++)

{

cin >> number;

intList.insertEnd(number);

}

cout << endl;

intList.print();

cout << endl;

cout << "The smallest number in intList: " << intList.min() << endl;

return 0;

}

```

Assuming that the `arrayListType` and `unorderedArrayListType` header and implementation files are properly included and compiled, this program should output the smallest number in the list.

Why it is necessary for young people to take ownership of finding a job

Answers

Explanation:

because it will give them more motivation on creating your own business

There are three emerging areas associated with technologies to monitor employees. Which of the following is one of those emerging areas?
Question 21 options:

How companies implement technology loss prevention programs.

How companies ban the use of social media.

How companies cope with employee misconduct.

How companies cope with BYOD.

Answers

Programs for preventing technology loss are a developing field related to technologies used to monitor employees. These programmes are intended to safeguard sensitive information and intellectual property.

What is technology for preventing data loss?

Users are prevented from sending sensitive or important information outside the company network by data loss prevention (DLP). The phrase refers to software tools that assist a network administrator in managing the data that users may send.

How can a firm be protected by a data loss prevention DLP strategy?

Data loss prevention (DLP) software keeps an eye on and guards against loss of network, endpoint, and cloud data. Reporting is a crucial component of data loss prevention since it demonstrates legal compliance and satisfies audit obligations.

To know more about Programs visit:-

https://brainly.com/question/10509036

#SPJ1

You are the IT administrator for a small corporate network. The network card in the desktop computer in Office 2 has gone bad. Rather than replacing the bad card, you have decided to connect the computer to the wireless corporate network. The wireless corporate network has the following characteristics:

Answers

Check to see if the DHCP server assigned the computer an IP address. By launching a command prompt, entering "ipconfig" (without quotes) and pressing Enter, you may verify this.

What's the format of the TestOut pc pro exam?

The TestOut PC Pro exam includes simulations and other questions that evaluate your skills. Test takers may be given a limited number of ungraded assignments that are used to evaluate and improve the exam. These exercises won't affect a test-final taker's score.

TestOut Network Pro: What is it?

The TestOut Network Pro certification assesses a candidate's proficiency in the tasks that systems administrators, network administrators, network engineers, and other IT network professionals frequently accomplish.

To know more about DHCP visit:-

https://brainly.com/question/29432103

#SPJ1

Harold wants to find all order numbers in his database that begin with "01" and replace them with "02." He places his cursor in the "Order Number" field and opens the "Find Dialog" box. Which steps would most quickly accomplish this
task?
A.) On the Find tab, enter "01" for "Find What," go to Replace tab, enter "02," and click "Replace." Continue to the next record and repeat.

B.) On the Replace tab, enter "01" to search, "02" to replace, and click "Replace All" to change all the order numbers that start with "01."

C.) On the Find tab, enter "01" for "Find What," go to Edit tab, enter "02," and click "Edit." Continue to the next record and repeat.

D.) On the Replace tab, enter "01" to search, "02" to replace, and click "Change All" to change all the order numbers that
start with "01."

Answers

Answer:

B.) On the Replace tab, enter "01" to search, "02" to replace, and click "Replace All" to change all the order numbers that start with "01."

Explanation:

A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields 3 fives and 4 ones. Write a single statement that assigns the number of one dollar bills to variable numOnes, given amountToChange. Hint: Use the % operator. (Java Please!)

Answers

Note that a Java statement that assigns the number of one-dollar bills to variable numOnes given amountToChange is given below.

int numOnes = amountToChange % 5;

What is the explanation for the above?

This statement uses the modulus operator, %, to calculate the remainder when amountToChange is divided by 5.

This remainder represents the amount of money that cannot be evenly divided into five dollar bills, and therefore must be given in one dollar bills. The result is assigned to the variable numOnes.

A Java statement is a unit of code that expresses an action or a command and ends with a semicolon.

Learn more about Java statement at:

https://brainly.com/question/14511771

#SPJ1

Describe the Police Act 1967.​

Answers

Answer:

Explanation:

Some of the key provisions of the Police Act 1967 include:

The establishment of police authorities to oversee and administer police forces.

The creation of a rank structure for police officers, including the appointment of Chief Constables and other senior officers.

The establishment of a system of police training and development, including the creation of the Police Staff College.

The extension of police powers to deal with a wide range of criminal activities, including terrorism.

The introduction of measures to improve police accountability and transparency, such as the requirement for police authorities to hold public meetings.

The Function Arguments dialog is
O different
O the same
O similar
O opposite
for each function.

Answers

Answer:

The Function Arguments dialog is the same for each function.

The Function Arguments dialog is typically the same for each function.

Thus, option (b) is correct.

When referring to functions within programming, the term "Function Arguments" typically pertains to the parameters or inputs that are passed to a function when it is called. The Function Arguments dialog remains the same for a particular function and specifies the type, order, and number of arguments that the function expects.

In programming languages, functions are defined with a specific set of parameters, and when calling the function, need to provide arguments that match those parameters.

Therefore, the Function Arguments dialog remains consistent for each function.

Thus, option (b) is correct.

Learn more about Function Argument here:

https://brainly.com/question/30029505

#SPJ4

Online data storage refers to the practice of storing electronic data with a third party services accessed via the internet
A true
B false​

Answers

Answer: I think the answer is true

Answer: the answer is true

what is the best software company in Hyderabad?

Answers

Answer:

Deloitte

benefits

1. highest salary package

2. hardword

Real GDP Government Spending (G) Tax Revenues (T) (Billions of dollars) (Billions of dollars) (Billions of dollars) 340 58 54 380 58 58 420 58 62 Use the blue line (circle symbols) to plot the government spending schedule presented in the table. Then use the orange line (square symbols) to plot the economy's tax revenues schedule. G T Deficits Surpluses 300 320 340 360 380 400 420 440 460 480 500 70 68 66 64 62 60 58 56 54 52 50 GOVERNMENT SPENDING AND TAXES (Billions of dollars) REAL GDP (Billions of dollars)

Answers

The deficits and surpluses can be calculated by subtracting government spending from tax revenue at each level of real GDP.

Explain the graph showing the government spending and tax revenue schedules?

The blue line with circle symbols represents the government spending schedule. It's a horizontal line at $58 billion, which means that regardless of the level of real GDP, the government spending remains constant at $58 billion.

The orange line with square symbols represents the economy's tax revenue schedule. It's an upward sloping line that starts at $54 billion when the real GDP is $340 billion and increases by $4 billion for every $40 billion increase in real GDP. For example, when real GDP is $380 billion, tax revenue is $58 billion; when real GDP is $420 billion, tax revenue is $62 billion.

The deficits and surpluses can be calculated by subtracting government spending from tax revenue at each level of real GDP. For example, when real GDP is $340 billion, the deficit is $4 billion ($58 billion - $54 billion); when real GDP is $420 billion, the surplus is $4 billion ($62 billion - $58 billion).

To learn more about tax, visit: https://brainly.com/question/14720363

#SPJ1

Describe the discretionary power of police​

Answers

Discretionary power refers to the authority given to police officers to use their judgment and make decisions about how to handle a situation based on their training and experience. Police officers have a range of discretionary powers, including the ability to decide whether or not to arrest someone, use force, search a person or property, or issue a warning or citation.

Police officers are trained to use their discretion in a way that is fair, impartial, and consistent with the law. They are expected to exercise their power in a way that promotes public safety and protects the rights of individuals. However, discretionary power can also be abused, leading to unfair treatment or discrimination based on factors such as race, ethnicity, or socio-economic status.

Police officers are held accountable for their use of discretionary power through internal review processes and external oversight by independent agencies. In some cases, excessive or inappropriate use of discretionary power can lead to disciplinary action, legal consequences, or civil suits against the police department.

Overall, the discretionary power of police is an important aspect of their role in maintaining law and order. However, it is important to ensure that this power is used in a way that is fair, transparent, and accountable, and that it promotes trust and confidence in the police force among all members of the community.

Craig has told his team to design a website, but he wants to see a fully laid out detailed version before functionality can be added. How can his team produce this?

Craig's team can demonstrate this by creating a(n)_______​

Answers

Answer:

Craig's team can produce a mockup or wireframe of the website to show a fully laid-out detailed version without functionality. A mockup is a static visual representation of the website's design, usually created with a graphic design tool or even drawn on paper. It serves as a blueprint for the website's layout, content, and visual elements. A wireframe, on the other hand, is a low-fidelity representation of the website's design that outlines the placement and structure of content and features. Both of these tools can help Craig's team communicate their design ideas to stakeholders and get feedback before moving on to the development stage.

Answer:

Craig's team can create a mockup or prototype of the website to demonstrate the fully laid out detailed version before adding functionality. A mockup is a static visual representation of the website design, while a prototype is an interactive and clickable version that allows users to navigate through the design and experience its functionality. Both mockups and prototypes can be created using various tools such as graphic design software or prototyping tools. By creating a mockup or prototype, Craig's team can showcase the website design to him and other stakeholders, get feedback, and make any necessary revisions before adding functionality and building the actual website.

the roles of I c t play in banking​

Answers

Answer: Information and communications technology

Explanation: Information and communications technology has played a significant role in banking over the years. In fact ICT has made the banking industry more competitive. ICT allows the banks to cater to the needs of customers by strengthening their internal control systems which are then backed by effective communications mechanisms.

Describe the roles of Police.​

Answers

Answer:

Police officers safeguard the people and their property,

 prevent crime, lessen public fear of crime, and enhance 

the quality of life for all residents in order to uphold law 

and order in their local communities.

Answer:

Some of the roles of the police include the following:

prevent anti-social behaviour

deal with community safety concerns

resolve disputes

attend accidents

investigate crime

enforce traffic law

deal with drug and alcohol affected people

attend critical incidents and emergencies.

Hope it helps :)

Question 18 of 50
A value inventory is a self-assessment test that measures the importance of certain values in order to guide an individual
his/her career path.
True
False

Answers

Answer:

true trust

explanation trust

Answer is true not false

Imad is a manage working in. Rang Mobile he can access the new customers report at any place with he need it what Characteristic of information is. best applied in this scenario 1_Reliable 2_Timely 3_Accurate 4_Secure​

Answers

"Timely" is the quality of information that fits this situation the best. Imad requires access to the new customer report whenever and wherever he wants it because he is a manager.

What essential qualities exist?

an essential quality. A product feature for which testing or inspection is necessary prior to shipment to assure conformance with the technical requirements under which the approval was obtained and which, if not manufactured as approved, could have a direct negative influence on safety.

What essential elements make up information integrity?

Integrity safeguards the information's accuracy or correctness while it is being processed, stored, or in transit. It serves as a guarantee that the information is accurate and unaltered.

To know more about access visit:-

https://brainly.com/question/14286257

#SPJ1

Saving the document means storing the document on to the secondary storage devices.
A true
B false ​

Answers

A it is true because secondary devices includes hard disk,flash drives and pen drives Etc means end of thinking capacity

Draw the ER diagram for the following entities: sume the attributes and relationship yourself Vehicle, Driver, Passenger, Road, License, Traffic Police, Accident, Alcohol ​

Answers

Answer:

1. Start

2. Declare variables x, y, and z

3. Assign a value to x

4. Assign a value to y

5. Add x and y and assign the result to z

6. Output the value of z

7. Stop

Explanation:

In this pseudocode, we start by declaring the variables x, y, and z. We then assign values to x and y, add them together, and store the result in z. Finally, we output the value of z and stop the program.

Pseudocode can be used as a way to plan out the logic of a program before writing actual code in a specific programming language. It can also be used as a way to communicate ideas about a program's logic without getting bogged down in the details of syntax and programming conventions.

Arithmetic Instructions: Activity: Execute a formula (Assembly code)

Read 3 numbers, add the first two, then subtract the third number from the sum. Final value should not be less than 0 or greater than 9

Sample
Input

4+1-2

Output

3

Answers

Here's an example Assembly code that reads 3 numbers, adds the first two, subtracts the third number, and ensures that the final value is not less than 0 or greater than 9:

```
ORG 0x100

START:
; Read the first number
MOV AH, 1
INT 21h
SUB AL, '0'
MOV BL, AL

; Read the second number
MOV AH, 1
INT 21h
SUB AL, '0'
ADD BL, AL

; Read the third number
MOV AH, 1
INT 21h
SUB AL, '0'

; Add the first two numbers and subtract the third number
SUB BL, AL
CMP BL, 0
JL SET_ZERO
CMP BL, 9
JG SET_NINE
JMP PRINT_RESULT

SET_ZERO:
MOV BL, 0
JMP PRINT_RESULT

SET_NINE:
MOV BL, 9
JMP PRINT_RESULT

PRINT_RESULT:
; Print the result
ADD BL, '0'
MOV AH, 2
MOV DL, BL
INT 21h

; Exit the program
MOV AH, 4Ch
INT 21h

END START
```

In this program, we first read the first number using the DOS interrupt `INT 21h` with function `AH=1`. We subtract the character code for '0' to convert it to a numeric value and store it in the `BL` register. We then read the second number and add it to the first number in `BL`. We read the third number and subtract it from the sum of the first two numbers in `BL`. We then compare the result to 0 and 9 to ensure that it is not less than 0 or greater than 9, respectively. If it is less than 0, we set it to 0. If it is greater than 9, we set it to 9. We then print the final result using the DOS interrupt `INT 21h` with function `AH=2`. Finally, we exit the program using the DOS interrupt `INT 21h` with function `AH=4Ch`.

Appendix D contains information about generating random numbers. To fully understand the process, you must learn more about Java classes and methods. For now, however, you can copy the following statement to generate and use a dialog box that displays a random number between 1 and 10: JOptionPane.showMessageDialog(null,"The number is "+ (1 + (int)(Math.random() * 10))); Write a Java application that displays two dialog boxes in sequence. The first asks you to think of a number between 1 and 10. The second displays a randomly generated number; the user can see whether his or her guess was accurate. (In future chapters, you will improve this game so that the user can enter a guess and the program can determine whether the user was correct. If you wish, you also can tell the user how far off the guess was, whether the guess was high or low, and provide a specific number of repeat attempts.) Save the file as RandomGuess.java

Answers

Answer:

import javax.swing.JOptionPane;

public class RandomGuess {

  public static void main(String[] args) {

     String guessString = JOptionPane.showInputDialog(null, "Think of a number between 1 and 10");

     int guess = Integer.parseInt(guessString);

     int random = 1 + (int)(Math.random() * 10);

     JOptionPane.showMessageDialog(null, "Your guess was " + guess + "\nThe number was " + random + "\n" + (guess == random ? "You guessed it!" : "Better luck next time."));

  }

}

Explanation:

This program prompts the user to think of a number between 1 and 10, then generates a random number in the same range and displays it in a dialog box along with the user's guess. If the guess matches the random number, the program displays a "You guessed it!" message; otherwise, it displays a "Better luck next time" message.

Write a Java Program to compute the area of a given classroom. Try the following different method headers. a) public static void calAreal() b) public static void calArea2(float length 1, float width 1 c) public static float calArea3 (float length2, float width2) ASU COT​

Answers

Answer:

a) Method header: public static void calArea1()

Pseudo code:

1. Define variables for length and width of the classroom

2. Read the values of length and width from the user

3. Compute the area of the classroom by multiplying length and width

4. Display the computed area of the classroom to the user

b) Method header: public static void calArea2(float length1, float width1)

Pseudo code:

1. Compute the area of the classroom by multiplying length1 and width1

2. Display the computed area of the classroom to the user

c) Method header: public static float calArea3(float length2, float width2)

Pseudo code:

1. Define a variable for area of the classroom

2. Compute the area of the classroom by multiplying length2 and width2

3. Return the computed area to the calling method

Explanation:

MS Word
Please explain why we use tables in documents.

Answers

Tables are often used in documents to present information in an organized and easy-to-read format.

How important are they?

They allow you to structure and categorize data into rows and columns, making it easier to compare and analyze information. Tables can be used for a variety of purposes, such as listing prices, displaying survey results, and summarizing data.

They also allow you to add visual elements to your document, such as borders, shading, and color, to make it more engaging and visually appealing. Overall, tables are a useful tool for presenting complex information in a clear and concise manner.

Read more about MS Word here:

https://brainly.com/question/25813601

#SPJ1

Other Questions
In a group of 15 children, 5 said they are an only child, 3 said they have 1 sibling only, 4 said they have exactly 2 siblings, and 3 said they have exactly 3 siblings.What is the average number of siblings for this group?Enter your answer as a decimal, rounded to the nearest tenth, in the blank. Please follow directions This film star, producer, and director (Amores perros, Y tu mam tambin, Babel, Diarios de motocicleta, Mozart in the Jungle) is considered one of Mexicos finest actors. Complete the sentences with the correct form of ir (a) or hacer to find out what is happening in his life.Gael Garca Bernal est en su apartamento en Nueva York. Tiene hambre; por eso, (1) _____ preparar los sndwiches. Sus hijos (children) son pequeos, pero (2) ______ ayudar a hacer los sndwiches tambin. Gael dice (says): Maana nosotros (3) Gael Garca Bernal est en su apartamento en Nueva York. Tiene hambre; por eso, (1) preparar los sndwiches. Sus hijos (children) son pequeos, pero (2) ayudar a hacer los sndwiches tambin. Gael dice (says): Maana nosotros (3) un viaje a Guadalajara a visitar a mis padres. Despus, (4) Buenos Aires donde vive Dolores, la mam de mis hijos. En este momento, ella (5) una pelcula (movie) nueva. Todos nosotros (6) Punta del Este a pasar tiempo en la playa (beach). Gael Garca Bernal est en su apartamento en Nueva York. Tiene hambre; por eso, (1) preparar los sndwiches. Sus hijos (children) son pequeos, pero (2) ayudar a hacer los sndwiches tambin. Gael dice (says): Maana nosotros (3) un viaje a Guadalajara a visitar a mis padres. Despus, (4) Buenos Aires donde vive Dolores, la mam de mis hijos. En este momento, ella (5) una pelcula (movie) nueva. Todos nosotros (6) Punta del Este a pasar tiempo en la playa (beach). Gael Garca Bernal est en su apartamento en Nueva York. Tiene hambre; por eso, (1) preparar los sndwiches. Sus hijos (children) son pequeos, pero (2) ayudar a hacer los sndwiches tambin. Gael dice (says): Maana nosotros (3) _____ un viaje a Guadalajara a visitar a mis padres. Despus, (4) _____ Buenos Aires donde vive Dolores, la mam de mis hijos. En este momento, ella (5) ______ una pelcula (movie) nueva. Todos nosotros (6) ______ Punta del Este a pasar tiempo en la playa (beach). un viaje a Guadalajara a visitar a mis padres. Despus, (4) Buenos Aires donde vive Dolores, la mam de mis hijos. En este momento, ella (5) una pelcula (movie) nueva. Todos nosotros (6) Punta del Este a pasar tiempo en la playa (beach). Hospital issued $20 million in zero-coupon, five-year bonds. Howmuch would the hospital receive in proceeds from the bondissue?$6,210,000$15,670,523$18,630,000$12,420,000 [The following information has been extracted from the financial statements of Itada Projects Limited:Extract of Statement of Comprehensive Income for the year ended 31 December 2019 2018 R R Revenue 2 000 000 1 600 000 Purchases 940 000 800 000 Operating profit 600 000 520 000 Profit before tax 520 000 450 000 Profit after tax 364 000 315 000Extract of Statement of Financial Position as at 31 December Assets 2019 2018 R R Non-current assets 2 000 000 1 400 000 Inventories 600 000 800 000 Accounts receivable 400 000 400 000 Cash and cash equivalents 2 000 2 000 3 002 000 2 602 000 R R Equity and liabilities Shareholders equity 2 000 000 1 500 000 Long-term loan 700 000 800 000 Accounts payable 182 000 142 000 Bank overdraft 120 000 160 000 3 002 000 2 602 000Note: 1. All purchases and revenue are on credit.2. Dividends paid during the year amounted to R218 400.3. The issued share capital consisted of 500 000 ordinary shares.Required: 2.1 Calculate the following ratios for the year ended December 2019.Where applicable, round off answers to two decimal places. 2.1.1 Operating margin (3) 2.1.2 Debtors collection period (3) 2.1.3 Acid test ratio (3) 2.1.4 Return on equity (3) 2.1.5 Debt to equity (3) 2.1.6 Earnings retention ratio (2) 2.1.7 Earnings per share (2)2.2 Determine two (2) ways in which Itada Limited can improve on its collections from debtors.2.3 Comment on the current ratio which dropped from 3.98:1 in 2018 to 3.32:1 in 2019. (2) 2.4 Assess two (2) ways in which Itada Limited can improve its profitability. Read this excerpt from a speech made by President Franklin D. Roosevelt on December 29, 1940, at the beginning of World War II in Europe.If Great Britain goes down, the Axis powers will control the continents of Europe, Asia, Africa, Australasia, and the high seas-and they will be in a position tobring enormous military and naval resources against this hemisphere. It is no exaggeration to say that all of us in all the Americas would be living at the point ofa gun-a gun loaded with explosive bullets, economic as well as military.We should enter upon a new and terrible era in which the whole world, our hemisphere included, would be run by threats of brute force. And to survive in sucha world, we would have to convert ourselves permanently into a militaristic power on the basis of war economy.Which statement best summarizes the central idea in this excerpt? what is the correct binary form of the decimal ip address 192.168.1.1? answer 11000000.10101000.00000010.00000001 10101100.00010001.00000001.00000001 11000000.10101000.00000001.00000001 00001010.10101000.00000001.00000001 Please ASAP HelpWill mark brainlest due at 12:00 One number is less than the other number by 10. The sum of there two number is 50. Find them Which of Mendel's laws BEST explains whygenetic variations occur in offspring resultingfrom sexual reproduction?A law of segregationB law of dominanceC law of independent assortmentD law of crossing-over Use the given information to find the unknown value.2. y varies1. y varies directly as the square rootinversely with the cube of x.of x. When x = 16, then y = 4. Find yy = 1. Find y when x = 1.when x = 36.When x = 3, then3. The distances that an object falls varies directly with thesquare of the time, t, of the fall. If an object falls 16 feet in onesecond, how long for it to fall 144 feet?4. The rate of vibration of a string under constant tension variesinversely with the length of the string. If a string is 24 inches longand vibrates 128 times per second, what is the length of a stringthat vibrates 64 times per second? What is the average of the given set of numbers? *23, 18, 35, 27, 19, 22, 25 22.6 24.1 7 169 22. Which of the following are the possible lengths to complete a triangle with side lengths of 9 in. and 11 in.? A greater than 2 in., less than 19 in. B greater than 2 in., less than 20 in. C greater than 4 in., less than 19 in. D greater than 4 in., less than 20 in. If you have a child that was acting really spoiled to you, what would you do?(I actually have no idea bro :P) PLEASE HELP ME IM FALLING ALL MY CLASSES ON EDMENTUN WILL GIVE BRAINLYIST PLEASE URGENTThe Trail of TearsIn the 1830s, President Jacksons removal policies forced many Americans Indian tribes to relocate from their ancestral lands. The Cherokee, Creek, Seminole, Chickasaw, and Choctaw traditionally lived in the southeastern regions of the United States. These tribes were forced by the US government to move to an area west of the Mississippi River that came to be known as the Indian Territory. Many died of starvation, cold, and diseases along the journey. This journey became known as the Trail of Tears. The map below shows the routes taken by the American Indian tribes during their relocation to the Indian Territory.Map of North America shows the Trail of Tears from 1838 to 1839.Take a look at the following timeline to understand the major events that led to the Trail of Tears.The Trail of Tears painting by Robert Lindneux shows the forced relocation of Native Americans.Refer to the websites below to learn more about the Trail of Tears.A Brief History of the Trail of TearsThe Trail of Tears and the Forced Relocation of the Cherokee NationPart AQuestionSelect the correct location on the map.Identify the location of the "Indian Territory" that tribes were forced to relocate to using the Trail of Tears. Part BIn 1973, Mary Hill of the Muskogee Indian Nation told an interviewer some of the stories her grandmother Sallie Farney had told her about the Trail of Tears. Read the given excerpt from the interview.The command for a removal came unexpectedly upon most of usWagons stopped at our home and the men in charge commanded us to gather what few belongings could be crowded into the wagons. We were to be taken away and leave our homes never to return.Many fell by the wayside, too faint with hunger or too weak to keep up with the rest. The aged, feeble, and sick were left to perish by the waysideThe little children piteously cried day after day from weariness, hunger, and illness. Many of the men, women, and even the children were forced to walkDeath stalked at all hours, but there was no time for proper burying of ceremonies There were several men carrying reeds with eagle feathers attached to the end. These men continually circled around the wagon trains or during the night around the camps. These men said the reeds with feathers had been treated by the medicine men. Their purpose was to encourage the Indians not to be heavy hearted nor to think of the homes that had been left. Some of the older women sang songs that meant, "We are going to our homes and land; there is One who is above and ever watches over us; He will care for us." This song was to encourage the ever downhearted Muskogees.Based on the excerpt, what physical and emotional challenges did the Muskogee face on the Trail of Tears? Space used (includes formatting): 119 / 15000Part CExamine the image. It's an artists representation of the Trail of Tears from a museum in Oklahoma.an illustration showing the journey of the Cherokee tribe during the Trail of TearsNow imagine you are leading a group of students around a museum and arrive at this image. Write a brief explanation of what you would tell the students to help them understand the history of this image. Use your interpretation of the image, information from the map above, the tutorials you've completed in this unit, and the sources linked above. Here are some questions to help you get started:Where did the journey shown most likely begin? Where are these people going, and why? What challenges did the people on this journey face, and how did they overcome them? What most likely happened to these people when they reached their destination? What historical events motivated this journey? How did this journey shape history after it? Amy is only nine years old and her total cholesterol is 550 mg/dL. Why do you think her cholesterol is so much higher than the others in her family who have familial hypercholesterolemia? You withdraw $46 a week from a savings account for 5 weeks. What is the overall change in the account? As discount rate increases, NPV of a simple project:Select one:a. Decreases at an increasing rateb. Decreases at a steady ratec. Decreases at a decreasing rated. Increases at a decreasing rate Read the excerpt from "The Crab That Played with the Sea. Which details from the excerpt best support the conclusion that this story is about the creation of the world? Select two options. TEXT LEVEL WORKComprehensionAWhy did the lambs have blood around their mouths?2 Where did the lambs try to hide and take shelter?3 Who are the 'red marauders'?4 What is the poet doing in the 'sheltered nook behind5 What 'gift' is the poet giving to the fox?BWhy does the poet say that his 'heart was sick'?2. What does the poet mean when he says. 'That only