Start by creating a new Visual Studio solution, but chose a “class library .Net Core” as the project type.
It will create a file and a class definition in that file. Rename the file to be ToDo.cs and accept the suggestion which will also rename that class to be
Class Todo
{
}
In that class, create
- a string property called Title
- an int property called Priority
- a bool property called Complete
Also, define one Constructor that takes in one string and one int.
In the constructor, use the passed in string to set the Title property and the passed in int to set the Priority property.
Also, set the Complete property to be false.
You are done with that class definition.
Now click on the Solution and add a new project, a .Net Core console project.
In the Main method,
[1] Define an array of type ToDo and size 3. The compiler will complain it does not know what a ToDo is. You need to add a reference from the Console Project to the Class Library. (see any of those 3 descriptions I listed above for how to do this. Don’t try going further until the compiler is happy with your array definition.)
[2] Ask the user to enter a ToDo title (like ”wash the car” or “buy groceries”
And also ask them for a priority which should be a 1, 2, or a 3.
Create a new ToDo object by calling the constructor and passing in these 2 user values.
Add this new ToDo object into your array at [0].
Repeat that code 2 more times so that the array has 3 ToDo objects in it.
Now build a for loop that writes out one line for each array element, using the 3 properties that each item has.
Your output should look something like
Wash the car Priorty:2 Completed: false
Buy groceries: Priorty 3 Completed: false
Do Prog120 Homework: Priority 1 Completed: false
Make sure the “false” comes from the property, don’t just hard code it in your for loop.
In: Computer Science
Complete the definitions for the following prototypes in the Time class:
Time(std::string) – a constructor that will take in a string with the format h:m:s and parse the
h, m and s into separate int values that can be used to set the time of a new time object.
int getSecond() const - return the value of the second void setSecond() - set the value of the second, making sure the new second value is valid before changing it.
std::string to24format() - return a string with the time in the format hh:mm:ss
Starting point for lab 3: https://repl.it/@jholst/Time-class-lab-3-starting-point
In: Computer Science
1.) Your employer is opening a new location, and the IT director has assigned you the task of calculating the subnet numbers for the new LAN. You’ve determined that you need 10 subnets for the class C network beginning with the network ID 192.168.1.0. How many host bits will you need to use for network information in the new subnets?
2.) After the subnetting is complete, how many unused subnets will be waiting on hold for future expansion, and how many possible hosts can each subnet contain?
3.) What is the new subnet mask?
4.) What is the new CIDR notation?
In: Computer Science
The main tasks of this C++ programming assignment include implementing a transformation matrix and a view/projection matrix. Giving three 3D points v0(2.0, 0.0, −2.0), v1(0.0, 2.0, −2.0), v2(−2.0, 0.0, −2.0),you are required to transform these points to the camera/view/monitor coordinates system, and draw a lined triangle based on them
get_projection_matrix(float eye_fov, float aspect_ratio, float zNear, float zFar): using the giving parameter, build a projection matrix, and return it.
Here is what I have so far.
Eigen::Matrix4f get_projection_matrix(float eye_fov, float
aspect_ratio,
float zNear, float zFar)
{
// Students will implement this function
Eigen::Matrix4f projection = Eigen::Matrix4f::Identity();
// TODO: Implement this function
// Create the projection matrix for the given
parameters.
// Then return it.
return projection;
}
In: Computer Science
Host A wants to send 15 frames to Host B using Selective repeat protocol. How many numbers of frames are transmitted by Host A if every 8th packet is lost or corrupted?
In: Computer Science
Many prestigious universities have a system called a “Legacy Preference System” which is used to decide which applicants should be accepted to the university. If an applicant’s parent is an alumnus of the university, the applicant will be admitted with lower GPA and SAT scores than if the parent is not an alumnus. (There is currently a lot of discussion about the fairness of this system, but universities get a lot of money from their alumni so they are unwilling to change it!!)
Your assignment for MP2 is to implement a computerized system like this for a very small prestigious university. The university has two schools, Liberal Arts and Music, each with their own criteria for accepting students. Your program must read in certain information about an applicant and print a message saying whether the applicant should be accepted or not.
The criteria for acceptance are:
Liberal Arts
Music – no preferences for alumni here.
Your program must accept as input the school the student is applying to (L or M), their high school grade point average, their math SAT score, their verbal SAT score and whether or not either parent is an alumnus (Y or N). The program must process several applicants, echoing the data for each applicant and printing a message indicating if the student was accepted to the school they were applying to. If they were not accepted, the message should indicate why. This message only has to indicate one reason for failure in cases of multiple disqualifications. Acceptances are to be made in the order received so that if a school is full, a later applicant cannot be accepted even if they happen to have better qualifications than an earlier one. You do NOT have to check for bad data coming from the file – assume that it is in the required format and has appropriate values.
The data file is arranged with the information for each applicant on a separate line. Your program must process the data until the end of file is reached, at which time the program must print out the total number of applicants and the number of acceptances to each school. The data file should be created by you. Create the file and store it in the same project folder as your program. Please turn in a hard copy of this file along with your program and output.
SUGGESTION You should design, compile, run and debug your program in stages. You might start by testing if your program can just read and echo the data file. After this is working accurately move on to identifying the school the person is applying to, then continue to add more of the details. Remember to use good style with consistent indentation, plenty of comments, good variable names etc. and don't forget to echo the data as it is read. The output must be clear and readable with appropriate string constants and spacing. Here is an example of the input data file:
L 4.0 600 650 N
M 3.9 610 520 N
L 3.8 590 600 N
…
Sample output from the first few lines of the example data file
follows:
Acceptance to College by (your name)
Applicant #: 1
School = L GPA = 4.0 math = 600 verbal = 650 alumnus = N
Applying to Liberal Arts
Accepted to Liberal Arts!!!
*******************************
Applicant #: 2
School = M GPA = 3.9 math = 610 verbal = 520 alumnus = N
Applying to Music
Accepted to Music!!
*******************************
Applicant #: 3
School = L GPA = 3.8 math = 590 verbal = 600 alumnus = N
Applying to Liberal Arts
Rejected - SAT is too low
*******************************
…
There were xx applicants in the file
There were xx acceptances to Liberal Arts
There were xx acceptances to Music
Press any key to continue
Use the following input file for your program, notice there is exactly 14 applicants, make sure you display the counts at the end of your output as in the sample above.
mp2accept.txt
L 4.0 600 650 N
M 3.9 610 520 N
L 3.8 590 600 N
L 3.0 600 600 Y
L 3.4 600 600 N
L 3.0 500 490 Y
L 2.9 500 500 Y
M 3.5 500 490 Y
M 3.9 490 600 Y
L 3.5 700 500 N
L 3.1 600 400 Y
L 3.0 490 510 Y
L 4.0 800 800 Y
M 3.2 500 500 N
here is my solution;(i don't know where I am wrong, I couldn't open up the mp2accept file)
#include <iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
//prompt the user for input
int x;
ifstream inputFileX;
inputFileX.open("Cis161:\\assignment2\\mp2accept.txt");// this
fstream is to read the data from the file
getline(inputFileX, line);
string mp2accept,line;
if (inputFileX.good() == false) {
cout << "Unable to open the
file named " << mp2accept;
exit(1);
}
while (true) {
getline(inputFileX, line);
if (inputFileX.eof()) break;
FILE OUTPUT
cout <<
line << endl;
//prompt the user for input
char school; // character variable for school and
alumunus
bool LiberalArts = false, Music = true;
int Math, Verbal; // Integer variable for SAT
score
int SAT;
float GPA; // float variable for GPA
char Alumunus;// character variable for alumunus
// is the student accepted either LiberalArts or
Music school
const int LiberalArtslimit = 5; // limits for counting
accepted and total applicants
const int Musiclimit = 3;
int LiberalArtsNum, MusicNum;
filename = "mp2accept.txt"; //opening file
// conitinuing extracting data
until end of the file
if (LiberalArtsNum ==
LiberalArtslimit)// checking for availability of seats
{
cout <<
"Sorry there is no avaialble seats\n";
return 1;
}
// Checking for other requirements
includes GPA
if ((GPA < 3.0 &&
Alumunus == 'Y') || (GPA < 3.5 && Alumunus ==
'N'))
{
cout << "Rejected" <<
endl;// print a messsage 'GPA is too low for art school'
}
if ((Math + Verbal < 1000 && Alumunus ==
'Y') || (Math + Verbal < 1200 && Alumunus == 'N'))
{
cout <<
"Rejected" << endl; //print a message'SAT is too low for art
school'
}
else
{
cout <<
"Applicant is accepted to LiberalArts" << endl;
LiberalArtsNum++; //counter for accepted applicant in LiberalArt
school
}
}
// iF appliacnt applied to Music school, checking
requirements
if (MusicNum == Musiclimit)// checking for
availability of seats
{
cout << "Sorry there is no
avaialble seats\n";
return 1;
}
else if (Math < 500) {
cout << "Rejected" <<
endl;// print a message'Math score is too low for admsission'
}
else if (Verbal < 500) {
cout << "Rejected" <<
endl;// print a message'Verbal score is too low for
admsission'
}
else
{
cout << "Accepted to Music"
<< endl;
MusicNum++; // count applicants
accepted in Music school
}
cout <<
"*******************************\n";
//Print overall output
cout << "There were" <<applicant
count<< "Applicants in the file" << endl;
cout << "There were" << LiberalArtsNum
<< "Applicants accepted in LiberaLArts" << endl;
cout << "There were" << MusicNum <<
"Applicants accepted in Music School" << endl;
return 0;
In: Computer Science
Convert these expressions to both sum of products and product of sums, minimizing where possible
1. abc+(d+e)c’+abc’
2. a(b+c(d+e))+d
In: Computer Science
Consider a Convolutional Neural Network which accepts a 120 x
120 CMYK image as input.
The network has a series of 5 convolutional layers, where the
parameters in conv-layer 3 and
conv-layer 5 are shared. Each conv-layer has 20 3x3 filters. The
output of the last conv-layer is
flattened and passed through a fully connected layer with 30
neurons, which is then passed
through another fully connected layer of 10 neurons. Each neuron in
the fully connected layers
and each filter in the conv-layers also have a scalar bias
associated with them, which are also
trainable parameters. Calculate the total number of trainable
parameters in the network. Show
your calculation.
In: Computer Science
Java project// please explain every statement with reasoning. Thank you Mary had a little lamb whose fl33ce was white as sn0w And everywhere that @Mary went the 1amb was sure to go.
Read from a file that contains a paragraph of words. Put all the words in an array, put the valid words (words that have only letters) in a second array, and put the invalid words in a third array. Sort the array of valid words using Selection Sort. Create a GUI to display the arrays using a GridLayout with one row and three columns.
The input file
Each line of the input file will contain a sentence with words separated by one space. Read a line from the file and use a StringTokenizer to extract the words from the line.
An example of the input file would be:
Mary had a little lamb
Whose fl33ce was white as sn0w.
You should have two files to submit for this project:
Project1.java
WordGUI.java
In: Computer Science
Python
create a function tryhard and print out the dictionary as a string form.
For example
def tryhard(d:dict):
#Code here
input: d = {'first': {}, 'second': {'1': {'move'}, '0': {'move', 'slow'}}, 'third': {'1': {'stop'}}}
output = " first movie: [ ]\n third movie: [('1', ['stop'])]\n second movie: [('0', ['slow', 'move']), ('1', ['move'])]\n"
In: Computer Science
Write a program that uses a structure to store the following weather data for a particular month: Total Rainfall High Temperature Low Temperature Average Temperature.
The program should have an array of 12 structures to hold weather data for an entire year.
When the program runs, it should ask the user to enter data for each month. (The average temperature should be calculated.)
Once the data are entered for all the months, the program should calculate and display the average monthly rainfall, the total rainfall for the year, the highest and lowest temperatures for the year (and the months they occurred in), and the average of all the monthly average temperatures. Input Validation: Only accept temperatures within the range between –100 and +140 degrees Fahrenheit.
In: Computer Science
Please choose the correct answer and add any additional information. Thanks :)
In: Computer Science
Using a combination of HTML/PHP, implement a web page where the users can upload a text file, exclusively in .txt format, which contains a string of 400 numbers, such as:
71636269561882670428 85861560789112949495 65727333001053367881 52584907711670556013 53697817977846174064 83972241375657056057 82166370484403199890 96983520312774506326 12540698747158523863 66896648950445244523 05886116467109405077 16427171479924442928 17866458359124566529 24219022671055626321 07198403850962455444 84580156166097919133 62229893423380308135 73167176531330624919 30358907296290491560 70172427121883998797
Your code should contain a PHP function that, accepting the string of 400 numbers in input, is able to find the greatest product of four adjacent numbers in all the four possible directions (up, down, left, right, or diagonally).
NOTE:
tester function should cover all possible checks:
1) correct file format
2) proper file contents
3) size of the file
4)For any file, with known answer check if the function returns the same answer (true test case). Because with null string and all the application itself wont work. Until we upload any file. You can add another possibilities here, will help in enhancing test cases.
Correct solution will be highly appreciated
In: Computer Science
Write a short bash script that takes in two arguments from a user, asks the user whether they would like to add, subtract, multiply, or divide. Each of these operations must be a function that returns data.
In: Computer Science
Add a generic Node class to the Java project.
In the class
Declare the fields using the generic type parameter, follow the book specification
Define the accessor method getLink( )
Define the constructor, follow the book implementation
Note: at the definition the name of the constructor is Node, however every time you use it as a type must postfix the generic type like Node<T>
Define the addNodeAfter( ) method as explained in the PP presentation, use the generic type as needed.
Usually Node classes do not need a toString method, but it is necessary when you test the Node class and want to verify the method behaviors. The purpose of toString( ) is, as always, to create and return a string representation of the state of the object, that is message that describes the field values.
Define a toString( ) method for the Node class, follow the bulleted hints below. Fields that are object references must call toString( ) for themselves. However, null reference cannot call any method, thus you have to take care about the cases when either of the fields data or link is null. Note that toString( ) never prints.
Declare two local variables of type String, say field1, field2, both initialized to the empty string.
If data is null, assign field1 the String value “dummy”, otherwise assign data.toString( )
If link is null, assign field2 the value “null in tail”, otherwise link.toString().
Return a message containing the field1 and field2. See the output templates below. The indentation as shown in the templates is somewhat tricky and not required for points.
Make the toString method take a dummy parameter int count, we will overload the method.
Discovery 1: toString( ) is a recursive method in this class, because it applies to the subsequent links as long as the link is not null. As such it iterates through the list.
A recursive method cannot exit until all nested recursive calls finished, and for correct execution the operating system must keep track of all activation records. Activation records occupy a lot of memory space called activation stack, therefore the stack size is usually limited around 10,000 nested recursive calls. In the applications you will check the stack size your operating system can tolerate when your toString( ) method is called.
Add another non-recursive toString method to the class, this does not take any parameter and ignores the link field. It simply returns data.toString( ) if data is not null, otherwise it returns null.
Testing the Node class
Add a NodeAppplication class to the project to test your nodes and methods.
Specify the generic type parameter as String, declare and instantiate a head node with constructor parameters “Paul” and null (the type for head is Node<String>).
Declare tail in the main method and assign it the return value of the addNodeAfter method called with respect to head, and with parameter ”Saul” (the type for tail is Node<String>).
Call and print the toString( 1 ) method (the one with dummy parameter) with respect to head, you must have output Figure 1.
Call addNodeAfter for head and then for tail repeatedly to produce output
Figure 2 (must maintain the tail reference properly).
Discovery 2: addNodeAfter( ) cannot create a new head since there is no precursor to head, head is not a link.
You create an artificial node named dummy (not part of the list of the actual data structure) to be positioned in front of head. The dummy node has nothing to do with the dummy parameter count.
Declare dummy as a node and instantiate it, the constructor takes parameters null for data and head for link
Call addNodeAfter with respect to dummy with parameter “Raul”, and assign the return value to head.
Call addNodeAfter for head with correct parameters and call toString( 1 ) for dummy to produce output Figure 3.
Change the toString (int count) definition such that count is updated in the parameter of the nested call with respect to link (now the dummy parameter is no longer dummy). The initial call should pass 1 for parameter. Since this test does not print the toString return value, you must add a printing statement first in the method’s body which prints the count value to the console.
Create a linked list of 100,000 nodes, each node carries a String data (those can all be same “Paul”). Call to string(1) and observe the last print of count before a StackOverflowError is thrown. Report your result as a comment added after the NodeApplication class.
Iterate over your large linked list, call the no-parameter non-recursive toString method w.r.t all the 100,000 nodes and print the return value to the console (you must use a loop).
Output templates
data: Paul
link: data: Saul
link: null in tail!
Figure 1
data: Paul
link: data: mauls
link: data: Saul
link: data: Saul
link: data: mauls
link: data: Raul
link: null in tail!
Figure 2
data: dummy
link: data: Raul
link: data: mauls
link: data: Paul
link: data: Paul
link: data: mauls
link: data: Saul
link: data: Saul
link: data: mauls
link: data: Raul
link: null in tail!
In: Computer Science