The program to check the highEst of n numbercan be done by ......,..

Answers

Answer 1

Answer: Given an array of numbers, arrange them in a way that yields the largest value. For example, if the given numbers are {54, 546, 548, 60}, the arrangement 6054854654 gives the largest value. And if the given numbers are {1, 34, 3, 98, 9, 76, 45, 4}, then the arrangement 998764543431 gives the largest value.

Explanation: If you need more help follow me on istagram at dr.darrien

-thank you


Related Questions

Develop a CPP program to test is an array conforms heap ordered binary tree. This program read data from cin (console) and gives an error if the last item entered violates the heap condition. Use will enter at most 7 numbers. Example runs and comments (after // ) are below. Your program does not print any comments. An output similar to Exp-3 and Exp-4 is expected.
Exp-1:
Enter a number: 65
Enter a number: 56 // this is first item (root,[1]) in the heap three. it does not violate any other item. So, no // this is third [3] number, should be less than or equal to its root ([1])
Enter a number: 45 // this is fourth number, should be less than or equal to its root ([2])
Enter a number: 61 // this is fifth number, should be less than or equal to its root ([2]). It is not, 61 > 55. The 61 violated the heap.
Exp-2:
Enter a number: 100
Enter a number: 95 1/ 95 < 100, OK
Enter a number: 76 // 76 < 100, OK
Enter a number: 58 // 58 < 95, OK
Enter a number: 66 1/ 66 < 95, OK
Enter a number: 58 // 58 < 76, OK
Enter a number: 66 // 66 < 76, OK
Exp-3:
Enter a number: -15
Enter a number: -5
-5 violated the heap.
Exp-4:
Enter a number: 45
Enter a number: 0
Enter a number: 55
55 violated the heap.

Answers

Answer:

Following are the code to this question:

#include<iostream>//import header file

using namespace std;

int main()//defining main method

{

int ar[7];//defining 1_D array that stores value      

int i,x=0,l1=1,j; //defining integer variable

for(i=0;i<7;i++)//defining for loop for input value from user ends  

{

cout<<"Enter a Number: ";//print message

cin>>ar[i];//input value in array

if(l1<=2 && i>0)//using if block that checks the array values  

{

x++;//increment the value of x by 1  

}

if(l1>2 && i>0)//using if block that checks the array values  

{

l1=l1-2;//using l1 variable that decrases the l1 value by 2  

}

j=i-x;//using j variable that holds the index of the root of the subtree

if(i>0 && ar[j]>ar[i])// use if block that checks heap condition  

{

l1++; //increment the value of l1 variable

}

if(i>0 && ar[j]<ar[i])// using the if block that violate the heap rule  

{

cout<<ar[i]<<" "<<"Violate the heap";//print message with value

break;//using break keyword  

}

}

return 0;

}

Output:

1)

Enter a Number: -15

Enter a Number: -5

-5 Violate the heap

2)

Enter a Number: 45

Enter a Number: 0

Enter a Number: 55

55 Violate the heap

Explanation:

In the above-given C++ language code, an array "ar" and other integer variables " i,x,l1, j" is declared, in which "i" variable used in the loop for input values from the user end.In this loop two, if block is defined, that checks the array values and in the first, if the block it will increment the value of x, and in the second if the block, it will decrease the l1 value by 2.In the next step, j variable is used that is the index of the root of the subtree. In the next step, another if block is used, that checks heap condition, that increment the value of l1 variable. In the, if block it violate the heap rule and print its values.

3. How many bytes of storage space would be required to store a 400-page novel in which each page contains 3500 characters if ASCII were used? How many bytes would be required if Unicode were used? Represent the answer in MB

Answers

Answer:

A total of 79.3mb will be needed

Briefly describe the importance of thoroughly testing a macro before deployment. What precautions might you take to ensure consistency across platforms for end users?

Answers

Answer:

Answered below

Explanation:

A macro or macroinstruction is a programmable pattern which translates a sequence of inputs into output. It is a rule that specifies how a certain input sequence is mapped to a replacement output sequence. Macros makes tasks less repetitive by representing complicated keystrokes, mouse clicks and commands.

By thoroughly testing a macro before deployment, you are able to observe the flow of the macro and also see the result of each action that occurs. This helps to isolate any action that causes an error or produces unwanted results and enable it to be consistent across end user platforms.

Consider the following Stack operations:

push(d), push(h), pop(), push(f), push(s), pop(), pop(), push(m).

Assume the stack is initially empty, what is the sequence of popped values, and what is the final state of the stack? (Identify which end is the top of the stack.)

Answers

Answer:

Sequence of popped values: h,s,f.

State of stack (from top to bottom): m, d

Explanation:

Assuming that stack is  initially empty. Suppose that p contains the popped values. The state of the stack is where the top and bottom are pointing to in the stack. The top of the stack is that end of the stack where the new value is entered and existing values is removed. The sequence works as following:

push(d) -> enters d to the Stack

Stack:  

d ->top

push(h) -> enters h to the Stack

Stack:

h ->top

d ->bottom

pop() -> removes h from the Stack:

Stack:

d ->top

p: Suppose p contains popped values so first popped value entered to p is h

p = h

push(f) -> enters f to the Stack

Stack:

f ->top

d ->bottom

push(s) -> enters s to the Stack

Stack:

s ->top

f

d ->bottom

pop() -> removes s from the Stack:

Stack:

f ->top

d -> bottom

p = h, s

pop() -> removes f from the Stack:

Stack:

d ->top

p = h, s, f

push(m) -> enters m to the Stack:

Stack:

m ->top

d ->bottom

So looking at p the sequence of popped values is:

h, s, f

the final state of the stack:

m, d

end that is the top of the stack:

m


​what are the morals and ethics of computer

Answers

Answer:

Computer ethics is a part of practical philosophy concerned with how computing professionals should make decisions regarding professional and social conduct. Margaret Anne Pierce, a professor in the Department of Mathematics and Computers at Georgia Southern University has categorized the ethical decisions related to computer technology and usage into three primary influences:

The individual's own personal code.

Any informal code of ethical conduct that exists in the work place.

Exposure to formal codes of ethics.

Explanation:

What is the quick key to highlighting a column?
Ctrl + down arrow
Ctrl + Shift + down arrow
Right-click + down arrow
Ctrl + Windows + down arrow

Answers

The quick key to highlighting a column is the Ctrl + Shift + down arrow. Thus, option (b) is correct.

What is column?

The term column refers to how data is organized vertically from top to bottom. Columns are groups of cells that are arranged vertically and run from top to bottom. A column is a group of cells in a table that are vertically aligned. The column is the used in the excel worksheet.

The quick key for highlighting a column is Ctrl + Shift + down arrow. To select downward, press Ctrl-Shift-Down Arrow. To pick anything, use Ctrl-Shift-Right Arrow, then Ctrl-Shift-Down Arrow. In the Move/Highlight Cells, the was employed. The majority of the time, the excel worksheet was used.

As a result, the quick key to highlighting a column is the Ctrl + Shift + down arrow. Therefore, option (b) is correct.

Learn more about the column, here:

https://brainly.com/question/3642260

#SPJ6

Answer:

its (B) ctrl+shift+down arrow

hope this helps <3

Explanation:

What are the constraints for designing small and large files and how these are resolved in different file system

Answers

Answer:

space management and buffering speed.

Explanation:

There are different types of file management systems in a computer system, examples of which are NTFS, FAT, WAFL, etc, and are governed by protocols like NFS, TFTP, FTP, etc.

These file systems are used in storages like the hard disk drive, CD and DVD, solid-state drive, etc, to organize or manage the files from boot setup, device drivers to permission-seasoned user files.

Files in storage range from small to large files, for which the schema of the file system must adjust to manage and allocate free space to other files in the future. The file system is also able to index the location of a file for retrieval to a cache memory, making buffering faster.

CHALLENGE ACTIVITY 3.7.2: Type casting: Reading and adding values.
Assign totalowls with the sum of num_owls A and num_owls_B.
Sample output with inputs: 34
Number of owls: 7
1. total_owls -
2.
3. num_owls A - input
4. num_owls_B - input
5.
6. " Your solution goes here
7.
8. print("Number of owls:', total_owls)

Answers

Answer:

total_owls = 0

num_owls_A = int(input())

num_owls_B = int(input())

total_owls = num_owls_A + num_owls_B

print("Number of owls:", total_owls)

Explanation:

Initialize the  total_owls as 0

Ask the user to enter num_owls_A and num_owls_B, convert the input to int

Sum the num_owls_A and num_owls_B and set it to the total_owls

Print the total_owls

avg_owls=0.0

num_owls_zooA = int(input())

num_owls_zooB = int(input())

num_owls_zooC = int(input())

num_zoos = 3

avg_owls = (num_owls_zooA + num_owls_zooB + num_owls_zooC) / num_zoos

print('Average owls per zoo:', int(avg_owls))

There is a problem while you are trying the calculate the average owls per zoo.

As you may know, in order to calculate the average, you need to get the total number of owls in all the zoos, then divide it to the number of zoos. That is why you need to sum num_owls_zooA + num_owls_zooB + num_owls_zooC and divide the result by num_zoos

Be aware that the average is printed as integer value. That is why you need to cast the avg_owls to an int as int(avg_owls)

Learn more about integer value on:

https://brainly.com/question/31945383

#SPJ6

what are three ways to add receipts to quick books on line receipt capture?

Answers

Answer:

1) Forward the receipt by email to a special receipt capture email

2) You can scan, or take a picture of the receipt and upload it using the QuickBooks mobile app.

3) You can also drag and drop the image, or upload it into QuickBooks Online receipt center.

Explanation:

1) Th first process is simply done using the email address

2) On the app, tap the Menu bar with icon ≡.  Next, tap Receipt snap., and then

tap on the Receipt Camera. Yo can then snap a photo of your receipt, and tap on 'Use this photo.' Tap on done.

3) This method can be done by simply navigating on the company's website.

You bought a monochrome laser printer two years ago. The printer has gradually stopped feeding paper. Which printer component should you check first

Answers

Answer:

Pick up roller

Explanation:

you should first check the pickup roller component. This component is the part of the printer that picks paper up from the paper tray. The pickup roller links the printer and the paper. When the printer printer is running, the roller would take paper from the paper tray for the printer to print on. One of the issues it can have is Paper jam where the roller would stop turning so that it will no longer be picking papers up from the tray.

What will be displayed after the following code executes? mystr = 'yes' yourstr = 'no' mystr += yourstr * 2 print(mystr)

Answers

Answer:

yesnono

Explanation:

mystr = 'yes'

yourstr = 'no'

mystr += yourstr * 2

mystr = "yes"yourstr * 2 = "no"+"no"yes + no+noyesnono

What is resource management in Wireless Communication? Explain its advantages

Answers

Answer:

This is a management system in wireless communication that oversees radio resources and crosstalks between two radio transmitters which make use of the same channel.

Explanation:

Radio Resource Management is a management system in wireless communication that oversees radio resources and crosstalks between two radio transmitters which make use of the same channel. Its aim is to effectively manage the radio network infrastructure. Its advantages include;

1. It allows for multi-users communication instead of point-to-point channel capacity.

2. it increases the system spectral efficiency by a high order of magnitude. The introduction of advanced coding and source coding makes this possible.

3. It helps systems that are affected by co-channel interference. An example of such a system is the wireless network used in computers which are characterized by different access points that make use of the same channel frequencies.

the part of the computer that contains the brain , or central processing unit , is also known the what ?

Answers

Answer:

system unit

Explanation:

A system unit is the part of a computer that contains the brain or central processing unit. The primary device such as central processing unit as contained in the system unit perform operations hence produces result for complex calculations.

The system unit also house other main components of a computer system like hard drive , CPU, motherboard and RAM. The major work that a computer is required to do or performed is carried out by the system unit. Other peripheral devices are the keyboard, monitor and mouse.

Consider the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last function called? Include with each visible variable the name of the function in which it was defined.a. Main calls fun1; fun1 calls fun2; fun2 calls fun3b. Main calls fun1; fun1 calls fun3c. Main calls fun2; fun2 calls fun3; fun3 calls fun1d. Main calls fun3; fun3 calls fun1e. Main calls fun1; fun1 calls fun3; fun3 calls fun2f. Main calls fun3; fun3 calls fun2; fun2 calls fun1void fun1(void);void fun2(void);void fun3(void);void main() {Int a,b,c;…}void fun1(void){Int b,c,d;…}void fun2(void){Int c,d,e;…}void fun3(void){Int d,e,f;…}

Answers

Answer:

In dynamic scoping the current block is searched by the compiler and then all calling functions consecutively e.g. if a function a() calls a separately defined function b() then b() does have access to the local variables of a(). The visible variables with the name of the function in which it was defined are given below.

Explanation:

In main() function three integer type variables are declared: a,b,c

In fun1() three int type variables are declared/defined: b,c,d

In fun2() three int type variables are declared/defined: c,d,e

In fun3() three int type variables are declared/defined: d,e,f

a. Main calls fun1; fun1 calls fun2; fun2 calls fun3

Here the main() calls fun1() which calls fun2() and fun2() calls func3() . This means first the func3() executes, then fun2(), then fun1() and last main()

Visible Variable:  d, e, f        Defined in: fun3

Visible Variable: c                 Defined in: fun2 (the variables d and e of fun2  

                                                                                                     are not visible)

Visible Variable: b                  Defined in: fun1 ( c and d of func1 are hidden)

Visible Variable: a                 Defined in: main (b,c are hidden)

b. Main calls fun1; fun1 calls fun3

Here the main() calls fun1, fun1 calls fun3. This means the body of fun3 executes first, then of fun1 and then in last, of main()

Visible Variable: d, e, f           Defined in: fun3

Visible Variable:  b, c              Defined in: fun1 (d not visible)

Visible Variable:  a                  Defined in: main ( b and c not visible)

c. Main calls fun2; fun2 calls fun3; fun3 calls fun1

Here the main() calls fun2, fun2 calls fun3 and fun3 calls fun1. This means the body of fun1 executes first, then of fun3, then fun2 and in last, of main()

Visible Variable:  b, c, d        Defined in: fun1

Visible Variable:  e, f             Defined in: fun3 ( d not visible)

Visible Variable:  a                Defined in: main ( b and c not visible)

Here variables c, d and e of fun2 are not visible

d. Main calls fun3; fun3 calls fun1

Here the main() calls fun3, fun3 calls fun1. This means the body of fun1 executes first, then of fun3 and then in last, of main()

Visible Variable: b, c, d     Defined in: fun1  

Visible Variable:   e, f        Defined in:  fun3   ( d not visible )

Visible Variable:    a          Defined in: main (b and c not visible)

e. Main calls fun1; fun1 calls fun3; fun3 calls fun2

Here the main() calls fun1, fun1 calls fun3 and fun3 calls fun2. This means the body of fun2 executes first, then of fun3, then of fun1 and then in last, of main()

Visible Variable: c, d, e        Defined in: fun2

Visible Variable:  f               Defined in: fun3 ( d and e not visible)

Visible Variable:  b               Defined in:  fun1 ( c and d not visible)

Visible Variable: a                Defined in: main ( b and c not visible)

f. Main calls fun3; fun3 calls fun2; fun2 calls fun1

Here the main() calls fun3, fun3 calls fun2 and fun2 calls fun1. This means the body of fun1 executes first, then of fun2, then of fun3 and then in last, of main()

Visible Variable: b, c, d       Defined in: fun1  

Visible Variable: e               Defined in: fun2  

Visible Variable: f                Defined in: fun3  

Visible Variable: a               Defined in: main

(Process scores in a text file) Suppose that a text file contains an unspecified number of scores. Write a program that reads the scores from the file and displays their total and average. Scores are separated by blanks. Your program should prompt the user to enter a filename. Here is a sample run:

Answers

Answer:

Here is the Python program:

def scores(file):  # method scores that takes a file name as parameter and returns the sum and average of scores in a file

   with open(file, 'r') as infile:  # open the file in read mode

       lines = [score.split() for score in infile]  # split the scores into a list

       print("The scores are:",lines)  #print the scores

       for line in lines:  # loops through each score

           total= sum(int(score) for score in line)  # adds the scores

           average =total/len(line) # computes average by taking sum of scores and dividing by number of scores in file

       print("The sum is:", total)  #prints the sum of scores

       print("The average is:", "{:.2f}".format(average))   #prints the average

filename = input("Enter name of the file: ")  #prompts user to enter name of file

scores(filename) #calls scores method by passing the file name to it in order to compute sum and average of file contents i.e. scores

Explanation:

It is assumed that the scores in the file are separated by a blank space.

The scores() method takes a file name as parameter. Then it opens that input file in read mode using object infile.

split() method is used to split the scores in a file into a list. Suppose the scores are 1 2 3 4 5 6 . So after the split, they become ['1', '2', '3', '4', '5', '6']  

The loop iterates through each score in the file, splits them into a list and stores this list in lines. The next print statement prints these scores in a list.

The second loop for line in lines iterates through each score of the list and the statements: total= sum(int(score) for score in line)  and average =total/len(line) computes the total and average of scores.

total= sum(int(score) for score in line)  statement works as follows:

for loop iterates through each element of list i.e. each score

int() converts that string element into integer.

sum() method adds the integers to compute their total.

So if we have  ['1', '2', '3', '4', '5', '6']  each element i.e. 1,2,3,4,5,6 is converted to integer by int() and then added together by sum method. So this becomes 1+2+3+4+5+6 = 21. This result is stored in total. Hence

total = 21.

average = total/len(line) works as follows:

The computed sum of scores stored in total is divided by the number of scores. The number of scores is computed by using len() method which returns the length of the line list. So len() returns 6. Hence

average = total/len(line)

              = 21 / 6

average = 3.5

The next two print statement prints the value of sum and average and "{:.2f}".format(average)) prints the value of average up to 2 decimal places.

The screenshot of the program along with its output is attached.

what makes''emerging technologies'' happen and what impact will they have on individuals,society,and environment

Answers

Answer:

Please refer to the below for answer.

Explanation:

Emerging technology is a term given to the development of new technologies or improvement on existing technologies that are expected to be available in the nearest future.

Examples of emerging technologies includes but not limited to block chain, internet of things, robotics, cognitive science, artificial intelligence (AI) etc.

One of the reasons that makes emerging technology happen is the quest to improving on existing knowledge. People want to further advance their knowledge in terms of coming up with newest technologies that would make task faster and better and also address human issues. For instance, manufacturing companies make use of robotics,design, construction, and machines(robots) that perform simple repetitive tasks which ordinarily should be done by humans.

Other reasons that makes emerging technology happens are economic benefit, consumer demand and human needs, social betterment, the global community and response to social problems.

Impact that emerging technology will have on;

• Individuals. The positive effect of emerging technology is that it will create more free time for individuals in a family. Individuals can now stay connected, capture memories, access information through internet of things.

• Society. Emerging technology will enable people to have access to modern day health care services that would prevent, operate, train and improving medical conditions of people in the society.

• Environment. Before now, there have been global complains on pollution especially on vehicles and emission from industries. However, emerging technology will be addressing this negative impact of pollution from vehicles as cars that are currently being produced does not use petrol which causes pollution.

what makes ''emerging technologies'' happen is the necessity for it, the need for it in the society.

The impact they will have on individuals ,society,and environment is that it will improve areas of life such as communication, Transportation, Agriculture.

What is Emerging technologies?

Emerging technologies can be regarded as the technologies in which their development as will as practical applications are not yet realized.

Learn more about Emerging technologies at:

https://brainly.com/question/25110079

What is the science and art of making an illustrated map or chart. GIS allows users to interpret, analyze, and visualize data in different ways that reveal patterns and trends in the form of reports, charts, and maps? a. Automatic vehicle locationb. Geographic information systemc. Cartographyd. Edge matching

Answers

Answer:

c. Cartography.

Explanation:

Cartography is the science and art of making an illustrated map or chart. Geographic information system (GIS) allows users to interpret, analyze, and visualize data in different ways that reveal patterns and trends in the form of reports, charts, and maps.

Basically, cartography is the science and art of depicting a geographical area graphically, mostly on flat surfaces or media like maps or charts. It is an ancient art that was peculiar to the fishing and hunting geographical regions. Geographic information system is an improved and technological form of cartography used for performing a whole lot of activities or functions on data generated from different locations of the Earth.

Answer:

C. Cartography

Explanation:

g Write a method that accepts a String object as an argument and displays its contents backward. For instance, if the string argument is "gravity" the method should display -"ytivarg". Demonstrate the method in a program that asks the user to input a string and then passes it to the method.

Answers

Answer:

The program written in C++ is as follows; (See Explanation Section for explanation)

#include <iostream>

using namespace std;

void revstring(string word)

{

   string  stringreverse = "";

   for(int i = word.length() - 1; i>=0; i--)

 {

     stringreverse+=word[i];

 }

 cout<<stringreverse;

}

int main()

{

 string user_input;

 cout << "Enter a string:  ";

 getline (std::cin, user_input);

 getstring(user_input);

 return 0;

}

Explanation:

The method starts here

void getstring(string word)

{

This line initializes a string variable to an empty string

   string  stringreverse = "";

This iteration iterates through the character of the user input from the last to the first

   for(int i = word.length() - 1; i>=0; i--)   {

     stringreverse+=word[i];

 }

This line prints the reversed string

 cout<<stringreverse;

}

The main method starts here

int main()

{

This line declares a string variable for user input

 string user_input;

This line prompts the user for input

 cout << "Enter a string:  ";

This line gets user input

 getline (std::cin, user_input);

This line passes the input string to the method

 revstring(user_input);

 return 0;

}

Cloud computing gives you the ability to expand and reduce resources according to your specific service requirement.

a. True
b. False

Answers

Answer:

a. True

Explanation:

Cloud computing can be defined as a type of computing that requires shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.

Generally, cloud computing offers individuals and businesses a fast, effective and efficient way of providing services.

In Computer science, one of the most essential characteristics or advantages of cloud computing is rapid elasticity.

By rapid elasticity, it simply means that cloud computing gives you the ability to expand and reduce resources according to your specific service requirement because resources such as servers can be used to execute a particular task and after completion, these resources can then be released or reduced.

Some of the examples of cloud computing are Google Slides, Google Drive, Dropbox, OneDrive etc.

Write an INSERT statement that adds this row to the Categories table:

CategoryName: Brass
Code the INSERT statement so SQL Server automatically generates the value for the CategoryID column.

Answers

Answer:

INSERT INTO categories (CategoryName)

VALUES ('Brass Code');

Explanation:

The SQL refers to the Structured Query Language in which the data is to be designed and maintained that occurred in the relational database management system i.e it is to be used for maintaining and query the database

Now the INSERT statement should be written as follows

INSERT INTO categories (CategoryName)

VALUES ('Brass Code');

Which of the following peripheral devices can be used for both input and output? mouse touch screen on a tablet computer printer CPU

Answers

Answer:

mouse printer CPU touch screen

Explanation:

on a tablet computer hope this helps you :)

Agile Software Development is based on Select one: a. Iterative Development b. Both Incremental and Iterative Development c. Incremental Development d. Linear Development

Answers

Answer:

b. Both incremental and iterative development.

Explanation:

Agile software development is based on both incremental and iterative development. It is an iterative method to software delivery in which at the start of a project, software are built incrementally rather than completing and delivering them at once as they near completion.

Incremental development means that various components of the system are developed at different rates and are joined together upon confirmation of completion, while Iterative development means that the team intends to check again components that makes the system with a view to revising and improving on them for optimal performance.

Agile as an approach to software development lay emphasis on incremental delivery(developing system parts at different time), team work, continuous planning and learning, hence encourages rapid and flexible response to change.

mplement the function fileSum. fileSum is passed in a name of a file. This function should open the file, sum all of the integers within this file, close the file, and then return the sum.If the file does not exist, this function should output an error message and then call the exit function to exit the program with an error value of 1.Please Use This Code Template To Answer the Question#include #include #include //needed for exit functionusing namespace std;// Place fileSum prototype (declaration) hereint main() {string filename;cout << "Enter the name of the input file: ";cin >> filename;cout << "Sum: " << fileSum(filename) << endl;return 0;}// Place fileSum implementation here

Answers

Answer:

Which sentence best matches the context of the word reticent as it is used in the following example?

We could talk about anything for hours. However, the moment I brought up dating, he was extremely reticent about his personal life.

Explanation:

Which sentence best matches the context of the word reticent as it is used in the following example?

We could talk about anything for hours. However, the moment I brought up dating, he was extremely reticent about his personal life.

A machine on a 10 Mbps network is regulated by a token bucket algorithm with a fill rate of 3 Mbps. The bucket is initially filled to capacity at 3MB. How long can the machine transmit at the full 10 Mbps capacity

Answers

2+4= this gbhfchgcjdxbhdch is correct

Write a method named coinFlip that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of whitespace-separated tokens. Assume that the input file data represents results of sets of coin flips. A coin flip is either the letter H or T, or the word Heads or Tails, in either upper or lower case, separated by at least one space. You should read the sequence of coin flips and output to the console the number of heads and the percentage of heads in that line, rounded to the nearest whole number. If this percentage is 50% or greater, you should print a "You win!" message; otherwise, print "You lose!". For example, consider the following input file: H T H H T Tails taIlS tAILs TailS heads HEAds hEadS For the input above, your method should produce the following output: 6 heads (50%) You win!

Answers

Answer:

Here is the JAVA program:

import java.io.*;

import java.util.*;

public class Main {

public static void main(String[] args) throws FileNotFoundException{ //the start of main() function body, it throws an exception that indicates a failed  attempt to open the file

Scanner input = new Scanner(new File("file.txt")); //creates a Scanner object and a File object to open and scan through the file.txt    

coinFlip(input);    } //calls coinFlip method

public static void coinFlip(Scanner input) { //coinFlip method that accepts as its parameter a string input holding a file name

while(input.hasNextLine()) { //iterates through the input file checking if there is another line in the input file

Scanner scan = new Scanner(input.nextLine()); //creates a Scanner object

int head = 0; // stores count of number of heads

int count = 0; //stores count of  total number of tokens

while(scan.hasNext()) { //iterates through the sequence checking if there is another sequence in the input file

String token= scan.next(); // checks and returns the next token

if (token.equalsIgnoreCase("H")||token.equalsIgnoreCase("Heads")) { //compares H or Heads with the tokens in file ignoring lower case and upper case differences

           head++;                } //if a token i.e. any form of heads in file matches with the H or Heads then add 1 to the number of heads

           count++;            } //increment to 1 to compute total number of counts

double result = Percentage(head, count); //calls Percentage method passing number of heads and total counts to compute the percentage of heads

System.out.println(head + " heads " + "(" + result +"%)"); // prints the number of heads

if(result >= 50.00) { //if the percentage is greater or equal to 50

System.out.println("You win!");} //displays this message if above if condition is true

else //if the percentage is less than 50

{System.out.println("You lose!");}  }    } //displays this message if above if condition is false

public static double Percentage(int h, int total) { //method to compute the percentage of heads

double p = (double)h/total* 100; // divide number of heads with the total count and multiply the result by 100 to compute percentage

return p;    } } //returns result

Explanation:

The program is well explained in the comments mentioned with each line of the above code. I will explain how the method coinFlip  works.

Method coinFlip accepts a string holding a file name as its parameter. It opens that file and reads its contents as a sequence of tokens. Then it reads and scans through each token and the if condition statement:

if (token.equalsIgnoreCase("H")||token.equalsIgnoreCase("Heads"))

checks if the each token in the sequence stored in the file is equal to the H or Heads regardless of the case of the token. For example if the first token in the sequence is H then this if condition evaluates to true. Then the head++ statement increments the count of head by 1. After scanning each token in the sequence the variable count is also increased to 1.

If the token of the sequence is HeAds then this if condition evaluates to true because the lower or upper case difference is ignored due to equalsIgnoreCase method. Each time a head is found in the sequence the variable head is incremented to 1.

However if the token in the sequence is Tails then this if condition evaluates to false. Then the value of head variable is not incremented to 1. Next the count variable is incremented to 1 because this variable value is always incremented to 1 each time a token is scanned because count returns the total number of tokens and head returns total number of heads in the tokens.

Percentage method is used to return the percentage of the number of heads in the sequence. It takes head and count as parameters (h and total). Computes the percentage by this formula h/total* 100. If the result of this is greater than or equal to 50 then the message  You win is displayed otherwise message You lose! is displayed in output.

Which recovery method helps users boot into an environment to get them back into the system so they can begin the troubleshooting process

Answers

Answer:

sfadasda

Explanation:

dsadasdadas

Write an interactive program to calculate the volume and surface area of a three-dimensional object.

Answers

Answer:

I am writing a Python program:

pi=3.14 #the value of pi is set to 3.14

radius = float(input("Enter the radius of sphere: ")) #prompts user to enter the radius of sphere

surface_area = 4 * pi * radius **2 #computes surface area of sphere

volume = (4.0/3.0) * (pi * radius ** 3) #computes volume of sphere

print("Surface Area of sphere is: ", surface_area) #prints the surface area

print("Volume of sphere is: {:.2f}".format(volume)) #prints the volume        

Explanation:

Please see the attachment for the complete interactive code.

The first three lines of print statement in the attached image give a brief description of the program.

Next the program assigns 3.14 as the value of π (pi). Then the program prompts the user to enter the radius. Then it computes the surface area and volume of sphere using the formulas. Then it prints the resultant values of surface area and volume on output screen.

The psuedocode for this program is given below:

PROGRAM SphereVolume

pi=3.14

NUMBER radius, surface_area, volume  

INPUT radius

COMPUTE volume = (4/3) * pi* radius ^3

COMPUTE surface_area = 4 * pi * radius ^ 2

OUTPUT volume , surface_area

END

The fact that the speed of a vehicle is lower than the prescribed limits shall relieve the driver from the duty to decrease speed when approaching and crossing an intersection. True or false

Answers

Explanation:

the answer is false ........

The fact that the speed of a vehicle is lower than the prescribed limits shall relieve the driver from the duty to decrease speed when approaching and crossing an intersection is not true.

What is intersection in the traffic rules?

An intersection serves as the point where many lanes cross on the road which is a point where driver is required to follow the traffic rules.

However, the above statement is not true because , a driver can decide not  decrease speed when approaching and crossing an intersection, even though it is a punishable offense in traffic rules.

Read more on traffic rules here: https://brainly.com/question/1071840

#SPJ2

By using ____, you can use reasonable, easy-to-remember names for methods and concentrate on their purpose rather than on memorizing different method names.

Answers

Answer:

Polymorphism

Explanation:

If we use polymorphism so we can apply the names that could be easy to remember for the methods' purpose.

The information regarding the polymorphism is as follows:

The person has various attributes at the same timeFor example,  a man could be a father, a husband, an entrepreneur at the same time.In this, the similar person has different types of behavior in different situations.

Therefore we can conclude that If we use polymorphism so we can apply the names that could be easy to remember for the methods' purpose.

Learn more about the behavior here: brainly.com/question/9152289

Write a program that reads the input.txt file character by character and writes the content of the input file to output.txt with capitalize each word (it means upper case the first letter of a word and lowercase remaining letters of the word)

Answers

Answer:

def case_convertfile( file_name):

    with open(" new_file","x") as file:

         file.close( )

    with open("file_name", "r") as txt_file:

     while True:

            word = txt_file.readline( )

            word_split= word.split(" ")

            for word in word_split:

                  upper_case = word.uppercase( )

                  file= open("new_file","w+")

                  file= open("new_file","a+")

                  file.write(upper_case)

     txt_file.close( )

     file.close( )

Explanation:

This python function would open an existing file with read privilege and a new file with write and append privileges read and capitalize the content of the old file and store it in the new file.

Other Questions
According to Aristotle, poetry is a form of _____ an electron travels at 0.3037 times the speed of light through a magnetic field and feels a force of 1.2498 pN. What is the magnetic field in teslas 6(x + 2) = 30Solve the following linear equation Discuss fivefive of component ofa map paul worked 50 hours last week. if he earns $10 per hour plus time-and-a-half for any hours worked beyond 40 in a week, how much did he earn last week? Some 150 million customers a month visit Amazon and the company passes through $160 billion in sales via its global supply channels and partnerships making interorganizational relationships very important to the company. Which interacting organization has a low coordination, low integration, transactional focus 7. Ms. House utilizes a strategy of "Check 1 2- 3". Why does she do this? How do you think this was initially taught? Handel was nicknamed The Red Priest. True False When brown iodine is exposed to starch it turns dark purple. In an experiment, you placed a cornstarch solution in a small plastic bag. Next, you placed the bag in a beaker of water containing 10 drops of iodine. If the solution in the plastic bag turned dark purple (Select all that apply) a) the plastic bag was permeable to cornstarch. b) the plastic bag was permeable to iodine. c) the iodine moved into the plastic bag. d) the cornstarch moved into the beaker. e) the plastic bag was selectively permeable. Spruce Ceramics produces large planters to be used in urban landscaping projects. A special earth clay is used to make the planters. The standard quantity of clay used for each planter is 24 pounds. The company uses a standard cost of $2.20 per pound of clay. Spruce produced 3,000 planters in May. In that month, 75,000 pounds of clay were purchased and used at the total cost of $162,000 Read the requirementsLOADING.... Requirement 1. Calculate the direct material price variance. Begin by determining the formula for the price variance, then compute the price variance for the direct materials. (Enter the variance as a positive number. Enter currency amounts in the formula to the nearest cent and then round the final variance amount to the nearest whole dollar. Label the variance as favorable (F) or unfavorable (U). Abbreviations used: DM = Direct materials) solve for x 3x - 4 = 3x - 10 How has the work of chemists affected the environment over the years? WILL GIVE BRAINLY!!!!!!!!!!!!!!!!!!!!!!!!!!There were six traits of good character discussed in the lesson: respect, compassion, perseverance, courage, integrity, and trustworthiness. Which of the listed traits is the theme of the poem It Couldnt Be Done? In a paragraph of not less than five sentences, discuss your choice and give at least two quotes from the poem to justify your selection. Somebody said that it couldnt be done But he with a chuckle replied That maybe it couldnt, but he would be one Who wouldnt say so till hed tried. So he buckled right in with the trace of a grin On his face. If he worried he hid it. He started to sing as he tackled the thing That couldnt be done, and he did it! Somebody scoffed: Oh, youll never do that; At least no one ever has done it; But he took off his coat and he took off his hat And the first thing we knew hed begun it. With a lift of his chin and a bit of a grin, Without any doubting or quiddit, He started to sing as he tackled the thing That couldnt be done, and he did it. There are thousands to point out to you one by one, The dangers that wait to assail you. But just buckle in with a bit of a grin, Just take off your coat and go to it; Just start in to sing as you tackle the thing That cannot be done, and youll do it. In a genetics experiment on peas, one sample of offspring contained green peas and yellow peas. Based on those results, estimate the probability of getting an offspring pea that is green. Is the result reasonably close to the value of that was expected? 350 127 3 4 The probability of getting a green pea is approximately . (Type an integer or decimal rounded to three decimal places as needed.) Is this probability reasonably close to ? Choose the correct answer below. 3 4 A. No, it is not reasonably close. B. Yes, it is reasonably close. Describe the similarities between H3O and NH3. Compare/contrast their shapes and polarities within the context of your answer. These molecules are called isoelectronic. Why Jon wants to buy carpet to cover his whole living room, except for the tiled floor. The tiled floorisoft by 3 1 ft. Find the area the carpet needs to cover. !1245tiled floorEntar It takes Serina 1.72 hours to drive to school. Her route is 47 km long. What is Serina's average speed on her drive to school? Your Answer : Ken received a 66 on his first math exam, which counted for 20% of his final grade; he now believes that he won't be able to pass the class. His conclusion best illustrates a pessimistic outlook. the fight-or-flight response. problem-focused coping. relative deprivation. AFind the value of x. Your answer must be exact.309 A company incurs $4,050,000 of overhead each year in three departments: Ordering and Receiving, Mixing, and Testing. The company prepares 2,000 purchase orders, works 50,000 mixing hours, and performs 1,500 tests per year in producing 200,000 drums of Goo and 600,000 drums of Slime. The following data are available: Department Expected use of Driver Cost Ordering and Receiving 2,000 $1,200,000 Mixing 50,000 1,500,000 Testing 1,500 1,350,000 Production information for Goo is as follows: Department Expected use of Driver Ordering and Receiving 400 Mixing 20,000 Testing 500 Compute the amount of overhead assigned to Goo. $2,760,000.