FindMaxNumber

Create a new program called FindMaxNumber.

Create an array of integers of size 10. Populate it with random numbers between 1-100. Pass array to your maximum method.

Create a method called maximum that passes an array of integers as a parameter and returns the maximum value in the array. For example, if the array passed stores {12, 7, -1, 25, 3, 9}, your method should return 25. Your method should not modify the elements of the array.

Print maximum number once returned to main method.

Also, use a for each enhanced loop to print all the array elements.

Answers

Answer 1

The python code to depict the program is:

import random

# Function which returns the maximum number

def FindMaxNumber(array):

   mx=0

   # iterate array and update element with the mx

   for num in array:

       mx=max(mx,num)

   # return mx

   return mx

# main method to gnerate 10 integers in between ranges

def main():

   # array of size 10

   array=[0]*10

   # Iterate 10 times and generate number

   for i in range(10):

       # generate random integer

       num=random.randint(1,100)

       # append into array

       array[i]=num

   # print array

   print("\nGenerate Array: "+str(array))

   # get maximum nummber

   maxNum=FindMaxNumber(array)

   # print maximum number

   print("Max Num: "+str(maxNum))

main()

What is a python?

Python is a popular computer programming language used to create software and websites, automate processes, and analyze data. Since Python is a general-purpose language, it can be used to create a wide range of programs and isn't tailored for any particular issues.

In this case, we've created a program called FindMaxNumber and created an array of integers of size 10. .

Learn more about python on:

https://brainly.com/question/26497128

#SPJ1


Related Questions

what is the unit of force​

Answers

Answer:The SI unit of force is the newton, symbol N. The base units relevant to force are:

The metre, unit of length — symbol m

The kilogram, unit of mass — symbol kg

The second, unit of time — symbol s

Explanation:Force is defined as the rate of change of momentum. For an unchanging mass, this is equivalent to mass x acceleration.

So, 1 N = 1 kg m s-2, or 1 kg m/s2.

The SI unit of force is the newton, symbol N.

for this question, you will be using the book and shelf classes described in the reading assignment. implement the following method so that it will search through all the books on the given shelf and return the first with an isbn number matching the parameter. all books on a shelf are represented by the list called books. if no book matches the given isbn, this method should return null. as remember that a book provides a getter method called getisbn().

Answers

A book's 10 digit ISBN (International Standard Book Number) is used to identify it.

The Title, Publisher, and Group of the book are represented by the first nine digits of the ISBN number, and the final digit is used to determine whether the ISBN is correct or not.

Its first nine digits can have any value between 0 and 9, but its final three digits occasionally have a value of 10, which is indicated by writing it as "X".

Calculate 10 times the first digit, 9 times the second, 8 times the third, and so on, up until we add 1 time the last digit to verify an ISBN.

If dividing the final number by 11 leaves no remnant, the code is a legitimate ISBN.

Know more about ISBN here:

https://brainly.com/question/23944800

#SPJ4

Your laptop's LCD screen is beginning to flicker and dim. You have checked the brightness setting to make sure that it is configured correctly.
Which of the following is the MOST likely cause of your screen issue?
The LCD screen inverter is failing.

Answers

Answer:

The LCD screen inverter is failing.

Which of the following commands allows a standard user to execute a single command as root without actually switching to the root account?Group of answer choicessudoersudosudoas

Answers

The correct response is b) sudo. The Linux command sudo, which stands for "super user do," enables the execution of programs as either the super user (also known as the root user) or another user.

Users must by default submit their own password for authentication, not the password of the target user, in contrast to the comparable command su. The system runs the requested command after authentication, if the configuration file (usually /etc/sudoers) grants the user access. The configuration file enables specific access rights, such as allowing commands only from the invoking terminal, needing a password per user or group, requiring a password to be entered each time, or never requiring a password at all for a given command line. Additionally, it can be set up to allow giving parameters or multiple instructions. The program sudo, which stands for superuser do or substitute user do, launches an elevated prompt without requiring you to assume a different identity. You can issue single commands as root or as another user, depending on the settings in the /etc/sudoers file.

Learn more about sudo here

https://brainly.com/question/6437006

#SPJ4

An ANOVA can find significant positive main effects at the same time as a significant negative interaction effect. True False

Answers

that is averaged over all other independent variable levels in experimental design and variance analysis.

Is it possible to have a large interaction but no major effect?

When the interaction is there, is it really required to include both main effects? No, you do not always require primary effects when there is an interaction, to put it simply. The interaction term won't, however, signify the same thing as it would if both primary impacts were taken into account.

What connection exists between interactions and major effects?

The impact one independent variable has on the dependent variable without taking into consideration other independent variables is known as a primary effect. The impact of one independent variable on another independent variable and how that impact affects the dependent variable is known as an interaction.

To know more about ANOVA visit ;

https://brainly.com/question/23638404

#SPJ4

To reduce the time it takes to start applications, Microsoft has created ____ files, which contain the DLL pathnames and metadata used by applications.

Answers

To reduce the time it takes to start applications, Microsoft has created prefetch files, which contain the DLL pathnames and metadata used by applications.

DLL is a multinational vendor finance firm with assets worth roughly EUR 35 billion. It offers asset-based financial solutions to the agriculture, food, healthcare, clean technology, construction, transportation, industrial, and office technology sectors. The company was established in 1969 and has its headquarters in Eindhoven, The Netherlands. The Rabobank Group's DLL is a completely owned subsidiary. DLL was named first among the Top 25 Vendor Finance firms in the United States in 2014 and placed among the Top 5 European Leasing Companies in 2013. CEO Carlo van Kemenade holds this position. The vendor financing division of Rabobank is called DLL. DLL offers financial solutions across a variety of sectors, including: clean technology, construction, transportation, industrial, office equipment, and agricultural, food, and healthcare.

Learn more about DLL here

https://brainly.com/question/23551323

#SPJ4

Show the stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in the following skeletal program. Assume bigsub is at level (7 pts)
function bigsub() {
function a() {
var one;
function b(five) {
var six;
var seven;
... <----------------------------1
} // end of b
function c(two,three) {
var four;
...
b(four);
...
} // end of c
...
c(one, one);
...
} // end of a
...
a();
...
} // end of bigsub

Answers

The static chain for function b consists of the activation records for functions c and a, and the dynamic chain for function b consists of the activation records for functions c, a, and bigsub.

Assuming execution reaches position 1, the stack contains the following activation record instances:

1.Activation dataset for function b with local variables 5, 6, and 7.

2. Activation record for function c with local variables 2, 3, and 4.

3. An activation record for function a that contains a static link to the local variable one and the activation record for function bigsub .

4. Activation record for feature bigsub with a dynamic link to the activation record for feature a.

The static chain for function b consists of the activation records for functions c and a, and the dynamic chain for function b consists of the activation records for functions c, a, and bigsub.

Read more about this on brainly.com/question/16251498

#SPJ4

In addition, you make sure to use _____ font sizes and colors for all of your data visualization titles.

Answers

Additionally, you take care to employ uniform font colors and sizes throughout all of your titles for data visualization.

What does the word "font" mean?

The term "font" describes a collection of text or typographic characters that may be printed or displayed in a certain size and style. In both physical and online text, many font types are utilized.

Contrast a typeface with a font.

A font is a specific collection of glyphs, usually known as kinds, which include the letters of the alphabet and indeed the associated marks for punctuation and numbers. For instance, Helvetica is a popular typeface. A typeface's specific set of glyphs is referred to as a font.

To know more about Font visit:

https://brainly.com/question/14934409

#SPJ1

The complete question is-

After reviewing your slide, you realize that the visual elements could be improved. You do this by first choosing one data visualization to share on this slide, then create another slide for the second data visualization.

In addition, you make sure to use _____ font sizes and colors for all of your data visualization titles.

Define a structure named StockItem with two string fields, supplier and productName and one int field, catalogNumber. Then define a structure named Customer with string (i.e., char *) fields name, streetAddress, city, postalCode, phone. Assume that structures named Date and Money have already been defined (representing a date and a monetary amount respectively. Finally, define a structure named Purchase that has these fields: buyer of type Customer, itemSold of type StockItem, dateOfSale of type Date, paid of type Money, returnable of type int (i.e., a boolean). SUBMIT 4 of 4: Tue Jun 22 2021 12:19:04 GMT+0300 (GMT+03:00)

Answers

StockItem structure, char productName[50], supplier[50]; catalogNumber, int}; Customer structure, name, street address, city, postal code, phone, and 50 characters of name; };Purchase structure

Make a StockItem struct with the following fields: char productName[50], char supplier[50], int catalogNumber;

- Create the following fields in a structure called "Customer": char name[50], streetAddress[50], city[50], postalCode[50], and phone[50];

- Construct a structure called Purchase with the following fields: bool returnable; struct Customer buyer; struct StockItem itemSold; struct DatedateOfSale; struct Money paid;

};

* It is expected that struct Date and Money was built in the manner described in the question.

Know more about structure here:

https://brainly.com/question/14962206

#SPJ4

one of benefits of this type of data entry is that it is easy to determine if the data are complete. a. Big data
b. Structured data
c. Aggregate data
d. Unstructured data

Answers

One of the benefits of this type of data entry is that it is easy to determine if the data are complete is structured data

What is a structured data?

Excel spreadsheets and SQL databases are typical instances of structured data. Each of them has structured, sortable rows and columns. A data model, which is a representation of how data can be stored, processed, and accessed, is necessary for the existence of structured data.

A data model, which is a representation of how data can be stored, processed, and accessed, is necessary for the existence of structured data. Each field is discrete and can be accessed independently or in conjunction with data from other fields thanks to a data model. Because it is feasible to swiftly aggregate data from many areas in the database, structured data is incredibly powerful.

Since the first database management systems (DBMS) could store, handle, and access structured data, structured data is regarded as the most "conventional" kind of data storage.

Hence to conclude the structured data is necessary for the data entry if the data is incomplete

To know more on structured data follow this link:

https://brainly.com/question/28583901
#SPJ4

keeping anti-virus applications up to date is an extremely important part of securing a network. anti-virus applications are constantly on the lookout for any sort of malicious application that could infect a device. which of the following might be a common update applied to anti-malware applications?

Answers

Antivirus software often operates using one of two methods: either it scans files and programs as they reach your device and compares them to known viruses, or it analyses program.

Furthermore, the bulk of antivirus software has the ability to either quarantine or destroy troublesome infections. Antivirus software is one of the most important tools you may have to protect your device. Understanding how antivirus software works is essential since attacks on your devices are becoming more sophisticated. Then, you'll be able to choose the things that are best for you.

Software that combats viruses is exactly what antivirus software is as its name suggests. It does this by means of a three-part system:

monitoring for viruses

detecting and removing viruses

As we stress in our digital security advice, your device needs malware protection to stay secure. Actually, malware risks are more prevalent than ever right now. For instance, between 2009 and 2019, the number of malware infections rose by more than 6,500%, from over 12 million to over 812 million. 1 Due to this rise, many devices now come pre-installed with antivirus and/or anti-malware software. The problem is that these systems typically do not offer complete threat protection.

Know more about antivirus here:

https://brainly.com/question/14313403

#SPJ4

Which of the following will lead to a compile-time error? Mark all that apply.

1
if (a > b) ( c = 0; )

2
if (a > b) { c = 0; }

3
if (a > b) c = 0 else b = 0;

4
if (a > b) c = 0;

5
if (a > b) then c = 0;

6
if a > b { c = 0; }

7
if a > b, then c = 0

Answers

All of the following will lead to a compile-time error:

if (a > b) ( c = 0; )if (a > b) then c = 0;if a > b { c = 0; }if a > b, then c = 0

Explanation:

In the given examples, 1, 2, 3, and 4 all have syntax errors that would cause a compile-time error. Example 5 has a syntax error because the keyword then is not used in most programming languages. Example 6 has a syntax error because it is missing the opening and closing parentheses around the condition. Example 7 has a syntax error because the , and then keywords are not used in most programming languages.

The statements that will typically lead to a compile-time error are as follows:

if (a > b) ( c = 0; ).if (a > b) then c = 0;if a > b { c = 0; }.if a > b, then c = 0.

Thus, the correct options for this question are A, B, E, and G.

What is a compile-time error?

A compile-time error may be characterized as those errors that indicate something that we need to fix before compiling the code. A compiler can easily detect these errors. It is the reason why we call them compile-time errors.

The above-mentioned statements contain errors that would cause a compile-time error. Statements 3 and 4 have syntax errors because the keyword then is not used in most programming languages and it is missing the opening and closing parentheses around the condition respectively.

Therefore, the correct options for this question are A, B, E, and G.

To learn more about Compile time errors, refer to the link:

https://brainly.com/question/27296136

#SPJ2

problem 3 given the root of a binary tree, return the level order traversal of its nodes' values, i.e., from left to right, level by level. def levelorder(root: treenode) -> list[list[int]]: example: the returned result of levelorder(root 1) should be a nested list [[5], [4, 8], [11, 13, 4], [7, 2, 5, 1]]. the ith elment of the nested list is a list of tree elements at the ith level of root 1 from left to right. (we had this problem before in assignment 3.) def level order(root: treenode):

Answers

The program for the given question is:

class Solution {

public:

   vector<vector<int> > levelOrder(TreeNode *root) {

       vector<vector<int> >  result;

       if (!root) return result;

       queue<TreeNode*> q;

       q.push(root);

       q.push(NULL);

       vector<int> cur_vec;

       while(!q.empty()) {

           TreeNode* t = q.front();

           q.pop();

           if (t==NULL) {

               result.push_back(cur_vec);

               cur_vec.resize(0);

               if (q.size() > 0) {

                   q.push(NULL);

               }

           } else {

               cur_vec.push_back(t->val);

               if (t->left) q.push(t->left);

               if (t->right) q.push(t->right);

           }

       }

       return result;

   }

};

To know more about the class click on the link below:

https://brainly.com/question/9949128

#SPJ4

Synergistic teamwork requires a commitment on the part of all parties to look for and work for win/win solutions. This can happen only when there are high levels of mutual trust and communication: "Not your way, not my way, but a better way."

Answers

Yes Synergistic teamwork requires a commitment on the part of all parties to look for and work for win/win solutions

What is synergistic teamwork?

Team synergy is the process through which a group of people collaborates to carry out a task by utilizing each person's abilities and distinctive viewpoints to achieve greater achievements than they could have done on their own.

Team synergy applies to teamwork the notion that the whole is greater than the sum of its parts. Team members can be fully themselves at work, bringing their individual life experiences, opinions, skills, and communication styles.

creates a stronger team. A team can be stronger overall if it includes a variety of talented people.enhances financesbetter work is produced.increases diversityenhances originality.

Hence to conclude the synergistic team work requires a commitment

To know more on team works follow this link:

https://brainly.com/question/28257420

#SPJ4

as an it technician, you added a printer for a client. when you did this, you were prompted to select and install the drivers.which of the following can you do to avoid repeating this step for subsequent clients?

Answers

Simply connect your printer's USB cable to an available USB port on your PC and turn on the printer. To open the Printers & scanners system setting, click the Search icon on the taskbar, type Printers in the search bar, and then click Printers & scanners from the search results.

What is a Printer?

A printer is a piece of external hardware that produces a hard copy of electronic data stored on a computer or other device.

For example, if you made a report on your computer, you could print multiple copies to hand out at a staff meeting. Printers are one of the most commonly used computer peripherals, and they are commonly used to print text and photos.

To know more about Printer, visit: https://brainly.com/question/27962260

#SPJ4

of the following statements, choose the one that most accurately distinguishes social media providers from social media sponsors.

Answers

The statement " Social media providers build and host website platform" is one of the most accurately distinguishing social media providers from social media sponsors.

What are web platforms?

The World Wide Web Consortium, as well as other standardization organizations like the Web Hypertext Application Technology Working Group, the Unicode Consortium, the Internet Engineering Task Force, and Ecma International, developed a collection of technologies known as the Web platform as open standards. a general phrase used to describe a website's architecture Website authoring tools like Dreamweaver or WordPress, as well as server software like Microsoft's IIS or Apache, can both be referred to as web platforms. web publishing and web authoring software.

To learn more about web platforms, use the link given
https://brainly.com/question/29481636
#SPJ4

3.Which of the following refers to a division of labor that ensures no one person can singlehandedly compromise the security of data, finances, or other resources?
a. MAC
b. RBAC
c. DAC
d. SoD

Answers

Segregation of Duties(SoD) is a system of delegation that makes sure no one person can, on their own, jeopardize the security of information, money, or other resources.

A business's internal controls and long-term risk management depend on the fundamental building block of segregation of duties (SOD). The foundation of the SOD principle is the division of duties among multiple parties or departments to carry out the crucial tasks of a vital process. Fraud and mistake hazards are significantly less controllable without this division in essential procedures.

This might be the SOD foundation for creating an accounting and finance report. The roles that can only be performed by different people are indicated by boxes with an "X" in them. For instance, the Engineer who creates the queries for a report shouldn't also be the one to approve their logic or accuracy.

Learn more about Segregation of Duties here:

https://brainly.com/question/28289850

#SPJ4

Hadoop is primarily a(n) ________ file system and lacks capabilities we'd associate with a DBMS, such as indexing, random access to data, and support for SQL.
distributed

Answers

Hadoop is primarily distributed File systems are used instead of DBMSs, which lack features like indexing, random access to data, as well as support for SQL.

What is SQL?
SQL (Structured Query Language) is a database programming language used to store, manipulate, and query data in a relational database. It is the most widely used programming language for database management systems. SQL consists of commands that are used to perform tasks such as retrieving data from a database, updating data in a database, modifying a database schema, and creating new database objects. It is a powerful language that allows users to quickly and efficiently manage data with minimal effort. SQL can be used in a wide variety of applications, including web development, data analysis, and database administration. It is an essential skill for any database professional, and is a great way to get started in the world of database programming.

To learn more about SQL
https://brainly.com/question/26701098
#SPJ1

How many records will the following query in the DOCTORS AND SPECIALTIES database return? SELECT table_name, column_name FROM user_tab_columns; DOCTORS AND SPECIALTIES Observe the DOCTORS AND SPECIALTIES database: DOCTOR DocID DocName 111 Jill 222 Linda 333 Lisa 444 Sue 555 Lola NoOfPatients SpecID 20 SUR 20 SUR 30 RAD 15 ANE 15 ANE SPECIALTY SpecID SpecName SUR Surgery RAD Radiology ANE Anesthesiology a. 2 b. 5 c. 6 d. 7 e. 10

Answers

Note that in the absence of database records, we cannot ascertain how many records the above query will return. Note that this query is an SQL QUERY.

What is an SQL Query?

An SQL query is a request for data from a database. It is written in a special language called SQL (Structured Query Language) that is designed specifically for accessing and manipulating data in a database. Queries are used to retrieve, add, update, or delete data from a database.

A database is a collection of data that is organized and stored in a way that allows for efficient retrieval and manipulation. It is typically used to store and manage large amounts of structured data, such as information about customers, products, or transactions. Databases are often used in computer applications to store and manage data.

Learn more about Database Records:
https://brainly.com/question/13158607
#SPJ1

refers to a broad class of web sites and services that allow users to connect with friends, family, and colleagues online as well as meet people with similar interests or hobbies.

Answers

Social networks refer to a broad class of Web sites and services that allows users to connect with friends, family, and colleagues online as well as meet people with similar interests or hobbies.

In today's Internet-based society and business, social networking is more crucial than ever. By connecting businesses with their target customers through social media, customers can find the goods and services they desire or need.

As an illustration, social networking platforms like enable companies to set up business fan pages, which they can use to post updates, images, locations, and rankings. Customers can submit reviews on the page in addition to rankings, which are visible to anyone who visits the page.

A company might utilize social networking sites because it is incredibly cost-effective, for example, if there aren't enough employees to administer the website at a particular time of day. These sites also offer advertising capabilities to promote your content and special offers and are less expensive. For example, there are several sites that allow you to reach individuals all over the world if you so choose.

To learn more about social networks click here:

brainly.com/question/6886851

#SPJ4

The Collections class of Java Collection Framework has several methods (e.g. sort(), min(), max()) that require natural ordering of the classes to be handled. Explain the two possible conditions that must be satisfied on the classes to be able to use the sort()method to arrange the list of objects these classes.

Answers

Answer:

Explanation:

Java Collections sort() Method :

By default, this method sorts the unsorted list into ascending order , according to the natural ordering of the list items. We can use Collections.reverseOrder() method for reverse sorting.

Condition are basically for any sorting algo. First one the Output is in non-decreasing order (Each elements is no smaller than the previous element according to the desired total order). Second is the output is a permutation (a reordering, yet retaining all of the original elements) of the input.

A premium pizza is comprised of exactly 40 ounces of toppings. The available toppings are listed below with their corresponding weight (in ounces). There can be multiple entries of each topping, as long as the total weight is equal to 40 ounces. [18 points] For example, a pizza can contain 1 topping of pepperoni, 2 toppings of sausage, 1 topping of bacon, and 2 toppings of onion:1∗4+2∗10+1∗6+2∗5=401∗4+2∗10+1∗6+2∗5=40(ounces) A pizza cannot contain 7 toppings of bacon:7 ∗6=42>40A pizza cannot contain only 3 toppings of sausage :3
*
10=30<40Define a rule pizza
(P,S,B,O,M)
to find out how many of each topping can be contained on a pizza, where arguments
P,S,B,O
, and
M
represent the weights (in ounces) of the Pepperoni, Sausage, Bacon, Onion, and Mushroom toppings, respectively. [14] 3.2 Use your pizza rule to find all possible outputs to the following question (goal). [2] I ?- pizza(1, S, 1, O, M). Put all answers of the question in a comment in the file. 3.3 Use your pizza rule to find all possible outputs to the following question (goal). [2] I ?- pizza(
P,S,B,O,1)
. Put all answers of the question in a comment in the file.

Answers

Exactly 40 ounces of ingredients make up a premium pizza. The toppings that are available are mentioned below with their associated weights (in ounces).

For illustration, a pizza toppings list might include two toppings of onion, one of bacon, two of sausage, and one of pepperoni.: 1*4 + 2*10 + 1*6 + 2*5 = 40 (ounces)

There cannot be seven bacon toppings on a pizza: 7 * 6 = 42 > 40

A pizza must have just three sausage toppings: 3*10 = 30 < 40

To determine the maximum number of each topping that can be placed on a pizza, define the rule pizza(P, S, B, O, M), where P, S, B, O, and M represent the weights in ounces of the toppings, respectively, of pepperoni, sausage, bacon, onion, and mushrooms.

pizza(P,S,B,O,M):-

member(P,[0,1,2,3,4,5,6,7,8,9,10]),

member(S,[0,1,2,3,4]),

member(B,[0,1,2,3,4,5,6]),

member(O,[0,1,2,3,4,5,6,7,8]),

member(M,[0,1,2,3,4,5]),

S is 4*P + 10*S + 6*B + 5*O + 7*M,

S =:= 40.

Learn more about pizza here:

https://brainly.com/question/14451377

#SPJ4

1. find a procedure for sampling uniformly on the surface of the sphere. a. use computer to generate a thousand points that are random, independent, and uniform on the unit sphere, and print the resulting picture. b. by putting sufficiently many independent uniform points on the surface of the earth (not literally but using a computer model, of course), estimate the areas of antarctica and africa, compare your results with the actual values, and make a few comments (e.g., are the relative errors similar? would you expect them to be similar? if not, which one should be bigger? etc.)

Answers

The probability density function (PDF) for uniform density across a unit sphere becomes P = 14 since the surface area of a sphere is [tex]A=4\pi r^{2}[/tex].

How do you sample uniformly from a sphere?

The three conventional normally distributed values X, Y, and Z can be used to create a vector, V=[X,Y,Z], which can be used as an alternate technique to create uniformly distributed points on a unit sphere.

V= [tex]4 / 3 \pi r^{3}[/tex]

A spherical sector's total surface area is equal to the sum of the zone's area and the lateral areas of its bordering cones. A spherical sector's volume, whether open or conical, is equal to one-third of the product of the zone's area and sphere's radius.

Additionally, Archimedes demonstrated that a sphere's surface area is [tex]4\pi r^{2}[/tex]. This proof was the crowning achievement of Archimedes' mathematical career, and he requested that it be memorialized on his tombstone as a sphere enclosed in a cylinder. the sphere enclosed by the cylinder.

To learn more about sphere refer to :

https://brainly.com/question/26834556

#SPJ1

Consider a system for processing student test scores. The StudentAnswerSheet class is given and will be used as part of this system and contains a student's name and the student's answers for a multiple-choice test. Note the class attribute (key) and method (setKey) for the loading and storing the answer key. The answers are represented as "char" with an omitted answer being represented by the question mark '?'. These answers are stored in an array in which the position of the answer corresponds to the question number on the test (question numbers start at zero). A student's score on the test is computed by comparing the student's answers with the corresponding answers in the answer key for the test. One point is awarded for each correct answer and 1/4 point is deducted for each incorrect answer. Omitted answers do not change the student's score.
Write a class GradeStudents with a "main" method only that will read, using Scanner, a filename from the user (assumed to exist and in the correct format). Then read the comma-delimited input file containing the answer key in the first row and student names/answers in other rows, one per line.
First read and load the key. Then read, grade and output each student. Also determine the highest scoring student. If ties for highest scoring save all their names. You do not know how many questions are on the test until you read the first line of the file, which is always the key.
Given class:
public class StudentAnswerSheet {
private String name;
private char [] answers;
private static final char BLANK='?';
private static final String DEFAULT_NAME="Noname";
private static final double CORRECT_POINTS=1., BLANK_POINTS=0., WRONG_POINTS=-.25;
private static char [] key;
public static void setKey(char [] answerKey) {
if (answerKey==null || answerKey.length==0) {
key=new char[] {'?'};
}
else {
key=new char[answerKey.length];
for (int i=0;i key[i]=answerKey[i];
}
}
}
public StudentAnswerSheet (String n, char [] a) {
if (n==null) {
name=DEFAULT_NAME;
}
else {
name=n;
}
if (a!=null && a.length>0) {
answers=new char[a.length];
for (int i=0;i answers[i]=a[i];
}
}
else {
answers = new char[] {'?'};
}
}
public String getName() { return name; }
public double getScore () {
double total=0;
if (key!=null && key.length == answers.length) {
for (int i=0;i if (answers[i]==BLANK) {
total+=BLANK_POINTS;
}
else if (answers[i]==key[i]) {
total+=CORRECT_POINTS;
}
else {
total+=WRONG_POINTS;
}
}
}
else {
total=Double.NEGATIVE_INFINITY;
}
return total;
}
public String toString () {
String temp = name;
for (int i=0; i temp = temp + ' ' + answers[i];
}
return temp;
}
}
SAMPLE INPUT FILES:
answers1.txt
KEY,e,e,b,b,e,b,c,d,a,e
Matt,a,e,b,b,?,b,c,d,a,e
Cami,e,e,b,b,?,b,c,d,a,e
John,?,?,?,?,?,?,c,d,a,e
Mary,a,a,a,a,a,a,c,d,a,e
Fred,e,e,b,b,?,b,c,d,a,ea
answers2.txt
KEY,e,e,b,b,e,b,c,d,a,e,e,e,b,b,e,b,c,d,a,e
Matt,a,e,b,b,?,b,c,d,a,e,a,a,a,a,a,a,c,d,a,e
Cami,e,e,b,b,?,b,c,d,a,e,?,?,?,?,?,?,c,d,a,e
John,?,?,?,?,?,?,c,d,a,e,a,a,a,a,a,a,c,d,a,e
Mary,a,a,a,a,a,a,c,d,a,e,a,a,a,a,a,a,c,d,a,e
Fred,e,e,b,b,?,b,c,d,a,e,e,e,b,b,?,b,c,d,a,e

Answers

To write a class GradeStudents with a "main" method only that will read, using Scanner, a filename from the user (assumed to exist and in the correct format) check the code given below.

What is a filename?

The title of a file and its extension are included in its filename. An entire file name is, for instance, "readme.txt."

Additionally, only the first part of a file may be described in the file name. A file with the name "readme" and the file name extension ".txt" is an example.

↓↓//CODE//↓↓

package code;

 public class TestResults

{

    private StudentAnswerSheet[] students;

    private int count = 0;

     private static final int DEFAULT_SIZE = 10;

     public TestResults(int size)

{

        if (size > 0) {

            students = new StudentAnswerSheet[size];

        }

        else {

            students = new StudentAnswerSheet[DEFAULT_SIZE];

        }

        count = 0;

    }

     public boolean addStudentAnswerSheet(StudentAnswerSheet x) {

        boolean inserted = false;

         if (x != null && count < students.length) {

            students[count] = x;

            count++;

            inserted = true;

        }

         return inserted;

    }

     public String highestScoringStudent(char[] answerKey) {

                 double maxScore = Double.MIN_VALUE;

        double tempScore;

                 // Finding maximum score

        for (StudentAnswerSheet sheet : students) {

            tempScore = sheet.getScore(answerKey);

                             if (tempScore > maxScore) {

                maxScore = tempScore;

            }

        }

                 // building highest achievers list

        StringBuilder res = new StringBuilder();

                 for (StudentAnswerSheet sheet : students) {

            if (sheet.getScore(answerKey) == maxScore) {

                res.append(sheet.getName()).append(" ");

            }

        }

                 // returning list string

        return res.toString().strip();

    }

}

Learn more about filename

https://brainly.com/question/28578338

#SPJ4

1. The containers for data and functions in a class definition can be divided into the following two types:

A) Methods and initializers.

B) Methods and access modifiers.

C) Methods and properties.

D) None of the above.

Answers

Answer:

C) Methods and properties.

Explanation:

while reviewing video files from your organization's security cameras, you notice a suspicious person using piggybacking to gain access to your building. the individual in question did not have a security badge. which of the following security measures would you most likely implement to keep this from happening in the future?

Answers

The security measures would you most likely implement to keep this from happening in the future are Mantraps. The correct option is a.

What are mantraps?

A mantrap is an access control device that consists of two interlocking doors and a tiny area. An individual is momentarily "stuck" in the vestibule before passing through the second door because one set of doors must close before the other one can be opened.

The most frequent application of mantraps in physical security is to demarcate non-secure areas from secure ones and to restrict access.

Therefore, the correct option is a, Mantraps.

To learn more about mantraps, refer to the link:

https://brainly.com/question/29744068

#SPJ1

The question is incomplete. Your most probably complete question is given below:

Mantraps

Spam and Phishing.

Malware.

Ransomware.

which of the following types of software programs would an employee use to prepare a form letter informing the company's clients of a change in product pricing:

Answers

Word processing is a software programs would an employee use to prepare a form letter informing the company's clients of a change in product pricing.

Definition of Word Processing Software

Word Processor Software is a

document processing program contains text and images that have a lot

privilege and very professional compared to existing text programs.

In a text-based operating system like DOS we can use the copy command

copy con for creating text files, although they are very, very limited. Whereas

in a GUI operating system like Windows, there is actually a notepad or

Wordpad whose ability to process words is quite good. However

because of the demands on the need to work with text and other objects

which are increasingly complex, in the end you have to use software that can actually fulfill it.

Currently there are a lot of word processing software that can

perform a variety of very complex tasks. Examples are

Wordstar, ChiWriter, WordPerfect, MS Work, Microsoft Word, KWriter and AmiPro.

The hallmark of word processing software in general is processing from

characters, words, sentences, which eventually form a paragraph, a group

paragraphs make up a page, and sets of pages make up a page

manuscripts which in this case are referred to as files or documents.

The main capabilities of word processing software include writing, forming (formatting) adding, deleting, saving and printing.

Your question is incomplete but most probably your full question was:

Which of the following types of software programs would an employee use to prepare a form letter informing the company's clients of a change in product pricing:

a. Word processing

b. Spreadsheet

c. Presentation

d. Database

Learn more about word processing at https://brainly.com/question/29762855.

#SPJ4

Which XXX causes every character in string x to be output? for (XXX) { System.out.println(x.charAt(i)); } i = 0; i <= x.length(); ++i i = 0; i < x.length(); ++i i = 0; i < (x.length() + 1); ++i i = 0; i < (x.length() - 1); ++i

Answers

i < inputWord.size(); ++i; I These cause the output of all the characters in string x. A string is a group of sequential characters used to represent text.

Sequential collections of System make up a String object. String-representing Char objects; a System. A UTF-16 code unit is represented by a char object. A string is often regarded as a data type and is frequently implemented as an array data structure made up of bytes (or words) that uses character encoding to hold a sequence of components, typically characters. Additionally, the term "string" can refer to more general arrays or other sequence (or list) data types and structures. String class.

Which XXX causes each character in the string inputWord to be produced for the (XXX) cout input command

for (XXX) {

cout << inputWord.at(i) << endl;

}

i = 0; i < inputWord.size(); ++i.

Learn more about string here

https://brainly.com/question/17238782

#SPJ4

Which functions read from the keyboard or write to the monitor? Choose all correct answers. (Please be advised that there is penalty for incorrect answers) O stdin O stdout O print O fprintf O getchar O getc O putchar

Answers

In the question, some functions are used to read data from keyobard or write to monitor.

In the given question, different functions are given such as stdin, stdout, print, fprintf, getchar, putchar and getc either to read the data from keyboard or print/write to monitor.

The detail of each function are given below.

Functions that read data from keyboards are:

getchar(): The getchar function read data from keyboard in form of characters.

getc(): it reads a single character from the current stream position and advances the stream position to the next character and it is identical to getchar() but it read one by one character.

However, stdin is not a function, but it is a class that provides methods to read the data such as getchar() and getc() etc.

Functions that print or write to monitor are:

print(): this function print or write to monitor.

fprintf(): this function also print or write to monitor but in the formatted way.

putchar(): This function is used to print one charter to monitor or on the screen.

However, stdout is not a function, but it is a class that provides methods to print the data to screen such as print, fprint, putchar() etc.

You can learn more about stdin and stdout at

https://brainly.com/question/14547401

#SPJ4

Identify who, if anyone, is responsible for preventing potentially harmful information from being shared via the Web

Answers

Answer:

the website owner

Explanation:

when you own a website it is up to you to change the privacy settings and/or delete private information from your users posts

Other Questions
When memorizing, your brain goes through all of the following processes, except which? A. Encoding B. Rearranging C. Storing direct speech to reported speech1) Abebe asked feyisa, did you hear me? "2) He said, she is ready to work with us" 3)The teacher ordered us, Be quiet and listen to my words"4) The teacher said, I plan to give you a test tomorrow" Question 1 (2 points)Determine the percent composition of chlorine in iron (III) chloride.?Question 2 (5 points) If we start this reaction with 40 grams of magnesium and an excess of nitric acid, how many grams of hydrogen gas could be produced?____ Mg + ____ HNO3 ____ Mg(NO3)2 + ____ H2If 1.7 grams of hydrogen is actually produced, what was the percent yield of hydrogen?Question 3 (6 points) Magnesium metal reacts quantitatively with oxygen to give magnesium oxide, MgO. If 5.00 g of Mg and 5.00 g of O2 are allowed to react, what weight of MgO is formed, and what weight of which reactant is left in excess? Question 4 (6 points) Mr.T thinks the windows need cleaning (instead of preparing his lesson), (What a mistake!). So instead he starts cleaning his office because it is a disaster. He pulls out the ammonia (NH3) and gets to work. It takes him 5 hours!! During that time he decides to do a little chemistry, because he doesn't want to fall behind. He weighs his bottle of ammonia before (32.3g) and after (30.7g) he cleans. Using this information, he calculates how many atoms are present in the ammonia he used during cleaning.Question 5 (6 points) Mr.T keeps getting in trouble for not cleaning his plate completely after supper every night. He argues that it is because there is water-insoluble compounds on his plate so the water won't clean it. Being the cheeky chemist that he is he comes up with a method to make carbon disulfide, a natural solvent for water-insoluble compounds like fats, oils, and waxes. He is going to make millions!! The unbalanced reaction is shown below. When 27.5 g of carbon reacts with 235 g of sulfur dioxide, what mass of carbon disulfide can Mr.T make? Balance the following equation and use it to determine the limiting reagent in order to answer the problem. when orsino asks cesario about the woman he loves, what type of irony is imbedded in cesario's response? Daisy and Petunia are flower vendors that operate in a duopoly (two-firm oligopoly). The daily marginal cost (MC) of producing a bouquet of flowers is constant and equals $0.40 per bouquet. Assume that neither firm had any startup costs. That is, marginal cost equals average total cost (AC) for each firm. Suppose that Daisy and Petunia form a cartel, and the firms divide the output evenly. (Note: This is only for convenience, since nothing in the model requires that the two companies must equally share the output.) Place the black point (plus symbol) on the following graph to indicate the profit-maximizing price and combined quantity of output if Daisy and Petunia choose to work together. Note: Drop lines will extend to both axes automatically. ? 2.00 1.80 Monopoly Outcome 1.60 1.40 1.20 PRICE (Dollars per bouquet) 1.00 0.80 0.60 MC = AC 0.40 0.20 MR Demand 0 40 360 400 80 120 160 200 240 280 320 QUANTITY (Bouquets of flowers per day) When they act as a profit-maximizing cartel, the total industry profit in the flowers market is per day. Suppose the flowers each company produces are regarded as perfect substitutes, such that if either company charged a price lower than the other, that company would receive all the business and profits in the industry. If both firms attempt to undercut each other, however, the result would be pricing at marginal cost and zero profit for both firms. The two firms intend to operate together in this market indefinitely, and at the beginning of each day, both firms individually choose whether to continue charging the collusive price. A firm that undercuts in a given month will receive (almost) the entire monopoly profit in that period, but no profit in any future periods. If the probability that both firms will continue operating and charging the collusive price in the next period is 0.60, then the expected stream of profits for one firm in the collusive equilibrium is Tacit collusion is therefore in this scenario. Suppose a third firm with the exact same costs and similarly substitutable flowers enters the market. If this firm joins the cartel, the expected stream of profits for an individual firm is now (again assuming a probability of 0.60 that production occurs in the next period). In this case, a tacit collusive agreement is in this problem, we will consider the same distributed averaging algorithm running on the above sensor network as described in hw3. to refresh your memory, the algorithm is such that at round k the rationale underlying the use of projective personality tests, such as the rorschach test and the thematic apperception test, is that they:______. explain how an sql injection attack works and what types of systems are vulnerable to this type of attack. a small em-wave source (i.e. a small collection of charges which is vibrating in simple harmonic motion having a known frequency) radiates an electromagnetic wave into the vacuum of space itself. of course, the electromagnetic wave consists of blocks of magnetic and electric fields which are leaving the vibrating source; these blocks of electric and magnetic fields leave the source in all possible directions (i.e. nothing has been done by the designers of the source to form the wave into a tight beam). as the wave moves away from the source, determine what happens to each of the following: a) the frequency of the electromagnetic wave o increases o decreases O remains constant (b) the intensity of the electromagnetic wave increases o decreases O remains constant Give your reasoning as briefly as possible I NEED HELP WITH #17HELP PLEASEE (ill give you brainliest) security issues are inevitable for your network. what type of policy includes a comprehensive set of steps that outline the proper response? the nurse has completed client teaching about heart failure and prescribed medications that include digoxin and furosemide. the nurse documents that the teaching goals have been met if the client states knowing to report which symptom? this term refers to the difference between what a child can do alone and what that child can do with the help of a teacher. zone of proximal development hypothetical thinking conservation egocentrism what series of standards developed by the u.s national security agency (nsa) defines how to shield systems and manifests in a number of different prod Federalists believe all of the following except: a. A loose interpretation of the U.S. Constitution b. The National Bank is Constitutional and will greatly benefit the nation c. Britain would make a better trade partner than France d. Tariffs are harmful to the U.S. economy, because they make goods more expensive An AC generator has a maximum output emf of 4.20 x 102 V. What is the rms emf? (Remember AVms = 0.707Vmax)a. 3 Vc.297 Vb.594 Vd.30 VPlease select the best answer from the choices provided Mark this and return4 George and Aimee are married. George has wage income of $190,000 and Aimee has a sole proprietorship that generated net income of $85,000. They also have interest and dividend income of $21,000. Compute any NIIT and Additional Medicare Tax they owe for the current year. two identical cylinders, a and b, contain the same type of gas at the same pressure. cylinder a has twice as much gas as cylinder b. which is true? how to calculate alpha value in case we got mixed type of inhibition and how to relate it with non-competitive and un-competitive inhibition? one word in this list doesn't belong to the same group: yen, pound, franc, penny, mark.