Questions
Pitch Deck Overview You have been hired to create a website. In this assignment, you will...

Pitch Deck

Overview

You have been hired to create a website. In this assignment, you will begin to gather the necessary information to complete the work and present your ideas to your client.

Instructions

You will need to answer the following questions:

  • What kind of domain names will you register (that is .com, .biz, .net, et cetera)? Why do you suggest this kind of domain? (Review the section in Week 1 on domain names.)
  • Will you register the site using multiple domains? Why is or isn't this necessary?
  • Will you need to secure any portion of your site? Why? (See the section on HTTPS.)
  • Given the nature of Web trends and changes in technology, what steps, if any, do you suggest to keep your site viable for more than one year?
  • What browsers do you anticipate your visitors will be using based on information available today?
  • Does the browser have any impact on your design?
  • Based on what you’ve just learned this week about CSS, how will this help in the development of your site?

In: Computer Science

Write a program to receive a string from the user and compares the first and second...

Write a program to receive a string from the user and compares the first and second half of the word and prints “First and Second Half Same” or “First and Second Half Different”. If the length of the word is odd, ignore the middle letter.

For example:

Run 1:

Enter a word: abcdabc

First and Second Half Same

Run 2:

Enter a word: abcde

First and Second Half Different

Hint: use the Math.floor() and length() to get the halves of the string and use the equals() to perform the similarity check inside if-else statement.

**********************************************************************************

Write a program that reads three different integers from the users and prints “all the same” if they are all equal, “all different”, if three numbers are different and “neither” for all other cases.

For example:

Enter first number: 3

Enter first number: 2

Enter first number: 6

All Different.

**********************************************************************************

Write a program that reads three different floating point numbers from the users and prints the largest of those three:

For example:

First number: 2.36

Second number: 2.99

Third number: 2.78

Largest: 2.99

In: Computer Science

Lee, J. G., Jun, S., Cho, Y. W., Lee, H., Kim, G. B., Seo, J. B.,...

  1. Lee, J. G., Jun, S., Cho, Y. W., Lee, H., Kim, G. B., Seo, J. B., & Kim, N. (2017). Deep learning in medical imaging: general overview. Korean journal of radiology, 18(4), 570-584.‏
  2. Choi, H. (2018). Deep learning in nuclear medicine and molecular imaging: current perspectives and future directions. Nuclear medicine and molecular imaging, 52(2), 109-118.‏
  3. Wang, G. (2016). A perspective on deep imaging. IEEE access, 4, 8914-8924.‏
  4. Jiang, F., Jiang, Y., Zhi, H., Dong, Y., Li, H., Ma, S., ... & Wang, Y. (2017). Artificial intelligence in healthcare: past, present and future. Stroke and vascular neurology, 2(4), 230-243.

  5. Fazal, M. I., Patel, M. E., Tye, J., & Gupta, Y. (2018). The past, present and future role of artificial intelligence in imaging. European journal of radiology, 105, 246-250.
  1. Please can you write a short paragraph 6-8 lines (summary) for each reference

In: Computer Science

THIS IS A C++ QUESTION(SOME OTHER ASSIGNMENTS ARE DISPLAYED TO GIVE BACKGROUND INFO ON THIS QUESTION,...

THIS IS A C++ QUESTION(SOME OTHER ASSIGNMENTS ARE DISPLAYED TO GIVE BACKGROUND INFO ON THIS QUESTION, ONLY THIS QUESTION SHOULD BE SOLVED):

Focus

  • Dynamic memory

Update

  • Do NOT make the Noble class a friend of the Warrior class.
  • Do NOT put a pointer in the Warrior class to the Noble class.

Problem:

Building on previous assignments, we will be reading a file of commands to create Nobles and Warriors, and sending them off to battle.

Previous Assignments(As Background info):

1) We will model a game of medieval times. Our world is filled with warriors. Naturally what warriors like to do is fight. To the death. So we happily let them.

Each warrior starts out with a name and a certain amount of strength. Each time he fights, he loses some strength. (He gets to keep his name.) If his opponent is stronger than he is, then he loses all of his strength, in which case he is dead, or at the very least pretty useless as a fighter. Otherwise he loses as much strength as his opponent had. Of course, if he and his opponent had the same strength then they are both losers.

Even losers are allowed to pick a fight. It doesn't require having any strength in order to do battle with someone else. Not that you stand much of a chance of winning anything, but perhaps it's worth getting beaten (again) just to have those 15 seconds of fame.

Your program will read in a file of commands. There are three types of commands:

  • Warrior creates a new warrior with the specified name and strength.
  • Battle causes a battle to occur between two warriors.
  • Status lists all warriors, alive or dead, and their strengths

2)

We will expand our Warrior a little. Each Warrior will have a weapon. He is "born" with it, i.e. the weapon is created together with the warrior. It can only be accessed by him. It provides him with his strength. In battle, weapons lose their edge and weaken. When a Warrior's weapon loses all of its strength, the Warrior himself dies.

Implementation

  • Remember that we are using data hiding. Therefore, every field, aka member variable, must be private.
  • What are the types of things in the problem? We will need a class for each type.
  • What do the things / types do? These "behaviors" should be represented as methods.
  • Weapons have both a name and a strength. The weapon is created together with the Warrior and cannot be accessed by anyone else.
  • Note that the input file changed a little, compared to the previous assignment. When a Warrior is created, instead of simply specifying his name and strength, the Warrior command specifies the Warrior's name as well as his Weapon's name and its strength.
  • The Status report will is also modified to show the name of the Warrior's Weapon.
  • No one can access a warrior's weapon except the warrior himself. But the weapon is what actually holds the warrior's strength. How does this effect the programming? Any time the code needs to know or change the warrior's strength, the warrior then "asks" the weapon what the strength is or tells the weapon that the strength needs to be changed. This represents the idea of delegation. We will see this concept frequently, where one object requests that another object do some task.
  • It is in fact unnecessary for any code other than a Warrior to even know about the Weapon. We will enforce this by nesting the definition of the Weapon class inside the Warrior class. To make sure that no code other than Warrior's makes use of Weapon, we need to make the class private.
  • The name of the input file will be "warriors.txt".
  • One last implementation detail. to display the information about an object, whether it is a warrior or a weapon, we will use that object's output operator.

3)

We will [continue to] model a game of medieval times. Our world is filled with not only warriors but also nobles. Nobles don't have much to do except do battle with each other. (We'll leave the feasting and other entertainments for add-ons.) Warriors don't have much to do except hire out to a noble and fight in his behalf. Of course the nobles are pretty wimpy themselves and will lose if they don't have warriors to defend them. How does all this work?

  • Warriors start out with a specified strength.
  • A battle between nobles is won by the noble who commands the stronger army.
  • The army's strength is simply the combined strengths of all its warriors.
  • A battle is to the death. The losing noble dies as does his warriors.
  • The winner does not usually walk away unscarred. All his men lose a portion of their strength equal to the ratio of the enemy army's combined strenth to their army's. If the losing army had a combined strength that was 1/4 the size of the winning army's, then each soldier in the winning army will have their own strength reduced by 1/4.

Hiring and Firing

  • Warriors are hired and fired by Nobles. Lack of adequate labor laws, have left the Warriors without the ability to quit, nor even to have a say on whether or not a Noble can hire them.
  • However it is possible that an attempt to hire or fire may fail. Naturally the methods should not "fail silently". Instead, they will return true or false depending on whether they succeed or not.
  • A Warrior can only be employed by one Noble at a time and cannot be hired away if he is already employed.
  • As noted below, Nobles who are dead can neither hire nor fire anyone. (Note this will implicitly prevent dead Warriors from being hired.)
  • When a warrior is fired, he is no longer part of the army of the Noble that hired him. He is then free to be hired by another Noble.
    • How do you remove something from a vector.
    • While there are techniques that make use of iterators, we have not yet discussed iterators so you will not use them here. (As a heads up, if you see a technique that requires you to call a vector's begin() method, that is using iterators. Don't use it.)
    • While it may seem a slight burden, certainly it does not require more than a simple loop to remove an item from a vector. No do not do something silly like create a whole new vector.
    • Soon we will cover iterators and then you will be freed from these constraints. Patience, please.

Death

It's a sad topic, but one we do have to address.

  • People die when they lose a battle, whether they are a Nobles or Warriors.
  • Nobles who are dead are in no position to hire or fire anyone. Any attempt by a dead Lord to hire someone will simply fail and the Warrior will remain unhired.
  • However curiously, as has been seen before, Nobles can declare battle even though they are dead.
  • Note that when a Noble is created he does not have any strength. At the same time he is obviously alive. So lack of strength and being dead are clearly not equivalent.

A test program and output are attached. Note that the output shown is what you are expected to generate. Pardon us, we don't like limiting your creativity, but having your output consistent with ours makes the first step of grading a bit easier. And also helps you to be more confident that your code works.

Key differences:

  • Each time a warrior or a noble is defined, we will create it on the heap.
  • We will keep track of the nobles in a vector of pointers to nobles.
  • We will keep track of all warriors using a vector of pointers to warriors.

Commands

  • Noble. Create a Noble on the heap.
  • Warrior. Create a Warrior on the heap.
  • Hire. Call the Noble's hire method.
  • Fire. Call the Noble's fire method.
  • Battle. Call the Noble's battle method.
  • Status. The status command shows the nobles, together with their armies, as we did previously. In addition, it will show separately the warriors who do not currentle have a employer
  • Clear. Clear out all the nobles and warriors that were created.

Our application is going to rely on each Noble having a unique name and each Warrior having a unique name. Otherwise, how would we be sure who we were hiring (or firing). Note that this is not a requirement of the Noble and Warrior classes themselves, just of this particular use of them, i.e. our application.

Whenever you are displaying a Noble or a Warrior, you will use the output operator for the class.

Handle errors!

Previously we promised that all of the commands we gave you the input would be valid. Now we would like you to take some responsibility for checking the input. First, we still guarantee that the format of the file will be correct. That means that the Warrior command will always have a name and a strength. The Battle command will always have two names. The Status command will not have any other information on it than just the word Status.

However, you will need to detect and report any issues indicating inconsistencies, such as:

  • Noble command: if a Noble with a given name already exists.
  • Warrior command:if a Warrior with a given name already exists.
  • Hire command: If a Noble tries to hire a Warrior and either of them do not exist.
  • Fire command: If a Noble tries to fire a Warrior and either the Noble does not exist or does not have the Warrior by that name in this army.
  • Battle command: If a Noble initiates a battle with another Noble, but one or the other does not exist

We have not specified the format of these error messages, so we'll leave that up to you. (You get to be creative!)

Input:

"Noble King_Arthur
Noble Lancelot_du_Lac
Noble Jim
Noble Linus_Torvalds
Noble Bill_Gates
Warrior Tarzan 10
Warrior Merlin 15
Warrior Conan 12
Warrior Spock 15
Warrior Xena 20
Warrior Hulk 8
Warrior Hercules 3
Hire Jim Spock
Hire Lancelot_du_Lac Conan
Hire King_Arthur Merlin
Hire Lancelot_du_Lac Hercules
Hire Linus_Torvalds Xena
Hire Bill_Gates Hulk
Hire King_Arthur Tarzan
Status
Fire King_Arthur Tarzan
Status
Battle King_Arthur Lancelot_du_Lac
Battle Jim Lancelot_du_Lac
Battle Linus_Torvalds Bill_Gates
Battle Bill_Gates Lancelot_du_Lac
Status
Clear
Status"

Output:

"Status
======
Nobles:
King_Arthur has an army of 2
        Merlin: 15
        Tarzan: 10
Lancelot_du_Lac has an army of 2
        Conan: 12
        Hercules: 3
Jim has an army of 1
        Spock: 15
Linus_Torvalds has an army of 1
        Xena: 20
Bill_Gates has an army of 1
        Hulk: 8
Unemployed Warriors:
NONE
You don't work for me anymore Tarzan! -- King_Arthur.
Status
======
Nobles:
King_Arthur has an army of 1
        Merlin: 15
Lancelot_du_Lac has an army of 2
        Conan: 12
        Hercules: 3
Jim has an army of 1
        Spock: 15
Linus_Torvalds has an army of 1
        Xena: 20
Bill_Gates has an army of 1
        Hulk: 8
Unemployed Warriors:
Tarzan: 10
King_Arthur battles Lancelot_du_Lac
Mutual Annihalation: King_Arthur and Lancelot_du_Lac die at each other's hands
Jim battles Lancelot_du_Lac
He's dead, Jim
Linus_Torvalds battles Bill_Gates
Linus_Torvalds defeats Bill_Gates
Bill_Gates battles Lancelot_du_Lac
Oh, NO!  They're both dead!  Yuck!
Status
======
Nobles:
King_Arthur has an army of 1
        Merlin: 0
Lancelot_du_Lac has an army of 2
        Conan: 0
        Hercules: 0
Jim has an army of 1
        Spock: 15
Linus_Torvalds has an army of 1
        Xena: 12
Bill_Gates has an army of 1
        Hulk: 0
Unemployed Warriors:
Tarzan: 10
Status
======
Nobles:
NONE
Unemployed Warriors:
NONE"

In: Computer Science

Question 2 Write a definition of a struct called Employee, which contains three fields: employment_id, int;...

Question 2

  1. Write a definition of a struct called Employee, which contains three fields:

employment_id, int; salary, float; marriage_status, bool.

  1. Given the above Employee struct, declare a variable x with this data type, and assign the three fields, respectively, to the values: 1234, 34000.00, true .

  1. Create a one-dimension array, y, of this struct data type with a length 4. Pass y into a function: PrintArrayElement( …).   Finish the interface of this function, and loop over each array element inside this function.

  1. Write a function printAttribute( ) inside struct Employee. The function should print out the value of each element along with its array index. In addition, it also print out the sum of salary for all the elements. Give a coding example of calling this function in main( ).

In: Computer Science

Classes and Objects are the central of Object Oriented Programming (O.O.P.) This is a style of...

Classes and Objects are the central of Object Oriented Programming (O.O.P.) This is a style of programming that focuses on using objects to design and build many great applications.

  1. What is the difference between a class an an instance of the class?
  2. Explain what is constructor? What do you call a constructor that accepts no arguments?
  3. Explain the "has-a" relationship can exist between classes.
  4. Explain what is the "this" keyword?
  5. Do the following:

  6. Answer the 4 points with only one paragraph each. Please note, this assignment needs to be spell and grammar checked prior to posting. (80% of Grade)
  7. Respond to at least two of your classmates findings in the Discussion. (20% of Grade)

In: Computer Science

c++: Exercise 1: Study the tutorial from Unit 6 on Sorting Arrays and Vectors. Write a...

c++:

Exercise 1:

Study the tutorial from Unit 6 on Sorting Arrays and Vectors.

Write a program that generates a sequence of 20 random values between 0 and 99 in an array, prints the sequence, sorts it, and prints the sorted sequence. Use the sort method from the C++ standard library. Do not add duplicate values to your array.  

Hint:

#include <algorithm>
#include "math.h"
using namespace std;
const int SIZE = 100;

while (numAdded < 100) {
val = floor(rand() % 100);  // Will generate values between 0 and 99
//  if unique add to array otherwise skip

}

//  Your unsorted array will look something like this. Use a loop, not a declaration to // add your values

{13, 7, 6, 45, 21, 9, 87, 99,...};
sort(arr);

// Sorted will be:

{0,1,2,3,....,99}

Exercise 2:

  Write a program that stores a list of countries: "Egypt", "Switzerland", "Argentina", "Spain", "Portugal", "Luxemburg", etc.

Initialize your array with a single statement. Then print out the array.

Use the sort function as before to sort the countries in alphabetical order.

Reprint your array.

Exercise 3:

Study the tutorial about vectors, if you haven't already. Implement exercises 1

and 2 using vectors. Then append an additional element to each list, print your

new lists and print and resort again.  

In: Computer Science

This is a discussion question for a Networking Essentials Class. What was the most important aspect...

This is a discussion question for a Networking Essentials Class.

What was the most important aspect of the Internet gaining wide acceptance in the United States?

Why?

In your answer consider networking, as well as identify hardware, software, network protocols, and legislation that have helped networking permeate into all layers of human life.

In: Computer Science

you will be implementing two functions for the LinkedList class. The function that you are implementing...

you will be implementing two functions for the LinkedList class. The function that you are implementing is called reverse and isPalindrome. The isPalindrome function should determine if the linked list is a palindrome or not and the reverse function should reverse the linked list.

When you are finished with the implementation, try to use valgrind to see if there are any other errors or memory leaks to deal with. valgrind ./lab7 or make val

  1. Expected Output

This is an example of what the output should look like. Note that the program must compile without any warnings or memory leaks.

==2353315== Memcheck, a memory error detector

==2353315== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.

==2353315== Using Valgrind-3.16.0 and LibVEX; rerun with -h for copyright info

==2353315== Command: ./lab7

==2353315==

The word: tenet is a palindrome.

The word: LOLO is not a palindrome.

The word: Zendaya is not a palindrome.

The word: kayak is a palindrome.

The word: step on no pets is a palindrome.

The word: I did did I is a palindrome.

The word: CMSC 202 is not a palindrome.

The word: wasitacatisaw is a palindrome.

==2353315==

==2353315== HEAP SUMMARY:

==2353315==     in use at exit: 0 bytes in 0 blocks

==2353315==   total heap usage: 158 allocs, 158 frees, 76,512 bytes allocated

==2353315==

==2353315== All heap blocks were freed -- no leaks are possible

==2353315==

==2353315== For lists of detected and suppressed errors, rerun with: -s

==2353315== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

In: Computer Science

F = (AB' +A'B)(C+ D') Implement F with AND-OR gates (denoted as F1) Implement F with...

F = (AB' +A'B)(C+ D') Implement F with AND-OR gates (denoted as F1)

Implement F with multi-level NAND gate circuit (denoted as F2)

Implement F with multi-level NOR gate circuit (denoted as F3)

Verify F1 = F2 = F3 (using Verilog Structural level modeling)

In: Computer Science

4.4 Lab: Arrays of Pointers to Structures (Sort) C++ programming This assignment is based on Homework...

4.4 Lab: Arrays of Pointers to Structures (Sort)

C++ programming

This assignment is based on Homework 3. The program will create an array of Airport structures. On the first line in the input file airports.txt there is an integer n, representing the number of lines in the input file. On each of the following n lines there is an airport code (a unique identifier) followed by the airport’s number of enplanements (commercial passenger boardings), and city served. You may assume that the data in the input file are sorted by the airport’s code as shown below:

4
BFL 100433 Bakersfield 
BUR 2077892 Burbank
LAX 39636042 Los Angeles 
MRY 192136 Monterey

Read n from this input file and use it to dynamically allocate an array of structures. Then continue reading from file to put data into the dynamically allocated array.

Create an array of n pointers to Airport structures and initialize each pointer to point to the corresponding element in the array of Airport structures.

Change the insertion sort algorithm to rearrange the pointes in the array of pointers to show the array of structures in descending order by the airport’s number of enplanements.

When done sorting the pointers, display the following report:

Original Order                   Descending (enp)
BFL Bakersfield        100433    LAX Los Angeles      39636042
BUR Burbank           2077892    BUR Burbank           2077892
LAX Los Angeles      39636042    MRY Monterey           192136
MRY Monterey           192136    BFL Bakersfield        100433

/*~*~*~*~*~*~
Pointers, Arrays, Structures, Sorting, and Dynamic Allocation of Memory
Name:
IDE:
*/

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>

using namespace std;

struct Airport
{
string code;
string city;
int enp;
};

// function prototypes
Airport *readArpData(string filename, int &size);
Airport **createPtrArray(Airport *list, int size);
void insertSort(Airport **pArp, int size);
void displayReport(Airport **pArp, Airport *list, int size);

int main()
{
Airport *list; // pointer to work with a dynamically allocated array of structs
Airport **pArp; // pointer to work with an array of pointers to structs
int size;
string filename = "airports.txt";
  
// function calls
cout << "Enter input file name: ";
cin >> filename;
// call readArpData
// call createPtrArray
// call insertSort
// call displayReport
  
return 0;
}

/*~*~*~*~*~*~
This function does the following:
- opens the input file(with validation: exit if file not found)
- reads size from the input file (the first number)
- dynamically allocates an array of size Airport structures
- reads data for size airports into the dynamically allocated array
- closes the input file
- returns the pointer to the dynamically allocated array
*~*/
Airport *readArpData(string filename, int &size)
{
ifstream inputFile;
Airport *list;
  
/* Write your code here */
  
return list;
}

/*~*~*~*~*~*~
This function ...

*~*/
Airport **createPtrArray(Airport *list, int size)
{
Airport **pArp;
  
/* Write your code here */
  
return pArp;
}

/*~*~*~*~*~*~
This function ...

*~*/
void insertSort(Airport **list, int size)
{
/* Write your code here */
}

/*~*~*~*~*~*~
This function ...

*~*/
void displayReport(Airport **pArp, Airport *list, int size)
{
cout << "\nOriginal Data Descending (enp)" << endl;
for (int i = 0; i < size; i++){
cout << /* code */ << " "
<< setw(15) << left << /* city */
<< setw(10) << right << /* enp */ << " ";
cout << /* code */ << " "
<< setw(15) << left << /* city */
<< setw(10) << right << /* enp */ << endl;
}
}


/*~*~*~*~*~*~ Save the output below

*~*/


In: Computer Science

Question 3 A. Show the output of the following code. #include <iostream> using namespace std; void...

Question 3

A. Show the output of the following code.

#include <iostream>

using namespace std;

void magic (int &a, int b, int& c)

{

  a *= 2;

   b = b+2;

   c = c-2;

}

int main ()

{

int x=1, y=3, z=7;

   magic (x, y, z);

cout << "x=" << x << ", y=" << y << ", z=" << z;

   magic (z, y, x);

cout << "x=" << x << ", y=" << y << ", z=" << z;

   return 0;

}

What is the parameter passing scheme for a, b and c in magic( ) function ?

B. Show the output of the following code.

#include <iostream>

using namespace std;

void printarray (int arg[], int length) {

   for (int n=length-1; n>=0; n--)

cout << arg[n] << " ";

   cout << endl;

}

int main ()

{

int firstarray[] = {3, 15, 10};

   int secondarray[] = {2, 4, 6, 8, 10};

   printarray (firstarray,2);

   printarray (secondarray,3);

   return 0;

}

In: Computer Science

Python Knapsack Problem: Acme Super Store is having a contest to give away shopping sprees to...

Python Knapsack Problem:

Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however each person can only take one of each type of item. For example, one family member can take one television, one watch and one toaster, while another family member can take one television, one camera and one pair of shoes.

Each item has a price (in dollars) and a weight (in pounds) and each person in the family has a limit in the total weight they can carry. Two people cannot work together to carry an item. Your job is to help the families select items for each person to carry to maximize the total price of all items the family takes. Write an algorithm to determine the maximum total price of items for each family and the items that each family member should select.

***In python:***

Implement your algorithm by writing a program named “shopping.py”. The program should satisfy the specifications below.

Input: The input file named “shopping.txt” consists of T test cases

T (1 ≤ T ≤ 100) is given on the first line of the input file.

Each test case begins with a line containing a single integer number N that indicates the number of items (1 ≤ N ≤ 100) in that test case

Followed by N lines, each containing two integers: P and W. The first integer (1 ≤ P ≤ 5000) corresponds to the price of object and the second integer (1 ≤ W ≤ 100) corresponds to the weight of object.

The next line contains one integer (1 ≤ F ≤ 30) which is the number of people in that family.

The next F lines contains the maximum weight (1 ≤ M ≤ 200) that can be carried by the ith person in the family (1 ≤ i ≤ F).

Output: Written to a file named “results.txt”. For each test case your program should output the maximum total price of all goods that the family can carry out during their shopping spree and for each the family member, numbered 1 ≤ i ≤ F, list the item numbers 1 ≤ N ≤ 100 that they should select.

Sample Input:

2

3

72 17

44 23

31 24

1

26

6

64 26

85 22

52 4

99 18

39 13

54 9

4

23

20

20

36

Sample Output:

Test Case 1

Total Price 72

Member Items

1: 1

In: Computer Science

In java What program would you write to solve the following problems and why does it...

In java What program would you write to solve the following problems and why does it work? Please also comment on other students’ code at least three times. 1) Write code to partition a linked list around a value x, such that all nodes less than x come before all nodes greater than or equal to x. If x is contained within the list, the values of x only need to be after the elements less than x. The partition element x can appear anywhere in the “right partition”; it does not need to appear between the left and right partitions. Input: 3à5à8à5à10à2à1 (partition=5) Output: 3à1à2à10à5à5à8. 2) Write a method that finds the maximum of two numbers. You should not use if-else or any other comparison operator. 3) Write methods to implement the multiply, subtract and divide operations for integers. The results of all of these are integers. Use only the add operator.

In: Computer Science

Visual Basics In this exercise, you modify the History Grade application from this chapter’s Focus lesson....

Visual Basics

In this exercise, you modify the History Grade application from this chapter’s Focus lesson. Use Windows to make a copy of the History Solution folder. Rename the copy History Solution-Functions. Open the History Solution.sln file contained in the History Solution-Functions folder. Modify the btnDisplay_Click procedure so that it uses two functions named GetGrade101 and GetGrade201 to get the appropriate grade; the procedure should then display the grade in the lblGrade control. Change the two independent Sub procedures to functions that return the appropriate grade to the statements that invoke them in the btnDisplay_Click procedure. Each function should contain a parameter that accepts the total points passed to it. Save the solution and then start and test the application.

Option Explicit On
Option Strict On
Option Infer Off

Public Class frmMain
    ' Independent Sub procedures.


    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
        ' Calls independent Sub procedures to display a grade.


    End Sub

    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub txtPoints_Enter(sender As Object, e As EventArgs) Handles txtPoints.Enter
        txtPoints.SelectAll()
    End Sub

    Private Sub ClearGrade(sender As Object, e As EventArgs) Handles txtPoints.TextChanged, radHis101.CheckedChanged, radHis201.CheckedChanged
        lblGrade.Text = String.Empty
    End Sub

    Private Sub txtPoints_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPoints.KeyPress
        ' Accept only numbers and the Backspace key

        If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
            e.Handled = True
        End If
    End Sub

In: Computer Science