Matlab work. Pleaae dont copy from any source.
Write a function that will accept a structure as an argument and return two cell arrays containing the names of the fields of that structure and the data types of each field. Be sure to check that the input argument is a structure, and generate an error message if it is not.
In: Computer Science
This is in JAVA
Shapes2D
Write the following four classes to practice using an abstract class and polymorphism. Submit all four classes.
Shape2D class
For this class, include just an abstract method name get2DArea() that returns a double.
Rectangle2D class
Make this class inherit from the Shape2D class. Have it store a length and a width as fields. Provide a constructor that takes two double arguments and uses them to set the fields. Note, the area of a rectangle is the length times the width.
Circle2D class
Also make this class inherit from the Shape2D class. Have it store a radius as a field. Provide a constructor that takes a double argument and uses it to set the field. Note, the area of a circle is PI times it's radius times it's radius.
Shape2DDriver class
Have this class provide a method named displayName() that takes an object from just any of the above three classes (you can't use an Object type parameter). Have the method display the area of the object, rounded to one decimal place.
In: Computer Science
In C++
Design an Essay class that is derived from the GradedActivity class: class GradedActivity{ private: double score; public: GradedActivity() {score = 0.0;} GradedActivity(double s) {score = s;} void setScore(double s) {score = s;} double getScore() const {return score;} char getLetterGrade() const; }; char GradedActivity::getLetterGrade() const{ char letterGrade; if (score > 89) { letterGrade = 'A'; } else if (score > 79) { letterGrade = 'B'; } else if (score > 69) { letterGrade = 'C'; } else if (score > 59) { letterGrade = 'D'; } else { letterGrade = 'F'; } return letterGrade; } The Essay class should determine the grade a student receives on an essay. The student's essay score can be up to 100, and is made up of four parts: Grammar: up to 30 points Spelling: up to 20 points Correct length: up to 20 points Content: up to 30 points The Essay class should have a double member variable for each of these sections, as well as a mutator that sets the values of these variables. It should add all of these values to get the student's total score on an Essay. Demonstrate your class in a program that prompts the user to input points received for grammar, spelling, length, and content, and then prints the numeric and letter grade received by the student.
In: Computer Science
Data Structures Homework – Singly Linked Lists
Create a singly linked that represents a school. The school has multiple classes. Each class has a different number of students.
class student
{
Long ID;
string Name;
string Address;
float grades[3];
student *below;
};
class Node // the node represents a class in school
{
int ID;
int NoOfStudents;
int NoOfQuizes;
student *t;// a linked list of students is allocated dynamically
Node *Next;
};
class school {
string Name;
Node *Head;
int n;//number of classes in school
};
First, you need to implement the following constructors and destructors:
1- School constructor: Creates an empty school. It takes the school name as a parameter and sets the number of classes to zero.
2- Class (Node) constructor: Sets the class ID, sets the number of students to zero, the NoOfQuizes to zero and the pointers to NULL.
3- Student constructor: Sets the student’s ID, Name and address which are passed as parameters once a student is created.
4- Student destructor: contains the cout statement: ”student destructor is called”
5- Class (Node) destructor: deletes all students in class.
6- School destructor: deletes all the classes in the school.
In your main function create an empty school by entering the name of the school from keyboard (this calls the school constructor), then display the following menu to the user and perform tasks accordingly.
In addition to constructors and destructors, you need to define a function to perform each of the following tasks.
Your program must keep on displaying this list until the user chooses Exit (12).
1. Create a class: This function creates a new class in the school by reading the class information from a text file that has the following format. The class is added to the end of the school linked list. Note that this will call the Node constructor (once)+ the student constructor (multiple times).
Class ID
NoOfStudents
Student ID Student Name Student Address
Student ID Student Name Student Address
Student ID Student Name Student Address
……..
2. Read quiz grades: This function takes the class ID and the number of the quiz (first:0, second:1, Final:2) from keyboard and reads the grades for all students in the class in a certain quiz. Sort the students alphabetically then read their grades (this calls the function sort students (8)).
3. Compute student’s average: Take a student’s ID and return his average
4. Add student: Enter class ID, read a student’s information (ID & name & address from keyboard), add a student to the beginning of the class list. Note that this calls the student’s constructor. Also, read (NoOfQuizes) grades for this student.
5. Delete student: Enter student’s ID, search for the student in the school and delete the student from his class (if found).
6. Delete class: Enter class ID, find the class, delete the list of students in the class (this uses class destructor) then delete the class node from the list (the rest of the school list should remain intact).
7. Sort students: Enter class ID and sort the students of that class based on their names in alphabetical order.
8. Find the student with maximum average in a certain class: Enter class ID, find student with maximum average, then display the student (name + ID).
9. Display student given his name: enter student’s name, find the student and display his ID, grades and average.
10. Display a class given its ID: enter a class ID, find the class and neatly display the information of all the students in that class.
11. Display school: Display all classes in a school. Display each class ID together with its students (ID, name and address of each student).
12. Exit .
In your main function, create a school and test all your work above.
make it clearly thanks..!!
In: Computer Science
Create a C++ project called RobberyLanguage. Ask the user to enter a word. Write a function that will receive the word, use the word to compile a new word in Robbery language and return the new Robbery language word. In the function: Use a while loop and a newline character (‘\0’) to step through the characters in the original string. How to compile a word in Robbery language: Double each consonant and put the letter ‘o’ between the two consonants. For example:" ENTER THE WORD: Welcome
original word is welcome , Robbery language: wowelolcocomome
process returned 0 (0*0) execution time :
press any key to continue "
Example of the definition of the function: string compileRobLanWord(char word[50]) Hints: Declare a new character string for the Robbery language word. A word in Robbery language has more characters than the original word. Therefor the new string must have its own index value. How it looks like in memory: Original word: S a m \0 2 0 1 2 3 Robbery language: S o S a m o m \0 0 1 2 3 4 5 6 7 Note: Remember to add the \0 character as the last character of the new word. In the main function: Example of the call statement in the main function: newWord = compileRobLanWord(word); Display the original word and the Robbery language word.
C#(VISUAL STUDIO)
In: Computer Science
Operating system
******Preemptive SJF************
The newly arrived process with shorter CPU burst will preempt the currently executing process.
Draw the Gantt Chart and calculate the average waiting time.
Process |
Arrival Time |
Burst Time |
Turn Around Time |
Waiting Time |
P4 |
0 |
5 |
||
P3 |
1 |
9 |
||
P2 |
2 |
4 |
||
P1 |
3 |
8 |
In: Computer Science
Run the following Java code and explain what it does.
Show the image created by the code.
public class Main{
public static void main(String[] args) {
new MyFrame();
}
}
import javax.swing.*;
public class MyFrame extends JFrame{
MyPanel panel;
MyFrame(){
panel = new MyPanel();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.add(panel);
this.pack();
this.setLocationRelativeTo(null);
this.setVisible(true);
}
}
import java.awt.*;
import javax.swing.*;
public class MyPanel extends JPanel{
//Image image;
MyPanel(){
//image = new ImageIcon("sky.png").getImage();
this.setPreferredSize(new Dimension(500,500));
}
public void paint(Graphics g) {
Graphics2D g2D = (Graphics2D) g;
//g2D.drawImage(image, 0, 0, null);
g2D.setPaint(Color.blue);
g2D.setStroke(new BasicStroke(5));
g2D.drawLine(0, 0, 500, 500);
//g2D.setPaint(Color.pink);
//g2D.drawRect(0, 0, 100, 200);
//g2D.fillRect(0, 0, 100, 200);
//g2D.setPaint(Color.orange);
//g2D.drawOval(0, 0, 100, 100);
//g2D.fillOval(0, 0, 100, 100);
//g2D.setPaint(Color.red);
//g2D.drawArc(0, 0, 100, 100, 0, 180);
//g2D.fillArc(0, 0, 100, 100, 0, 180);
//g2D.setPaint(Color.white);
//g2D.fillArc(0, 0, 100, 100, 180, 180);
//int[] xPoints = {150,250,350};
//int[] yPoints = {300,150,300};
//g2D.setPaint(Color.yellow);
//g2D.drawPolygon(xPoints, yPoints, 3);
//g2D.fillPolygon(xPoints, yPoints, 3);
//g2D.setPaint(Color.magenta);
//g2D.setFont(new Font("Ink Free",Font.BOLD,50));
//g2D.drawString("U R A WINNER! :D", 50, 50);
}
}
In: Computer Science
Science Model
One share of Global Core Development Systems, Inc (an imaginary company with the abbreviation: Go-CDS) stock was priced at $14.59 on January 1, 2015. Your tasking in this problem is to determine how long does it take for a stockholder to double their money who has invested in Go-CDS? In other words, how long until the price per share has doubled.
Here are some facts about Go-CDS:
Write a MATLAB program to solve the following questions: Use matlab to make plot
1. In what month does the stock exceed 2 times the price of $14.59?
2. Prepare a plot of the stock's per-month price movement over the course starting from the first month of year 2017 until the price has exceeded 2 times the price of $14.59. (You plot should start from month 25, and should cover the month that is the answer to Question #1.) You will need to adjust the plot routine to ONLY show these months.
To limit the plot to these months, add the following command after your xlabel and ylabel commands:
axis ([25, 56, 19, 31]) |
xticks (0:4:length(P)) |
yticks (0:2:31) |
In: Computer Science
I need the java code for a 4-function calculator app on android studio (do this on android studio). Please make sure all the requirements shown below are followed (such as the error portion and etc). The topic of this app is to simply create a 4 function calculator which calculates math expressions (add, subtract, multiply, and divide numbers).
The requirements are the following :
- The only buttons needed are 0-9, *, /, +, -, a clear, and enter button
- Implement the onclicklistener on the main activity
- The calcuator should use order of operations (PEMDAS)
- It should be able to continue from a previous answer (Ex: If you type 2+6 the calculator will display 8. If you then multiple by 2 the current result will simply be multiplied by 2)
- It should read the entire sequence of numbers and operators and save them into a String. The information can be read out of the String using a StringTokenizer. The delimiters will be the operators on the calculator.
- The entire mathematical expression will be displayed on the screen before the equal button is clicked.
- The equation will simply be evaluated in the order that the user types in the numbers rather than the precedence
- If the user enters an equation with invalid syntax, the output should display “error”. The calculator should also display “error” for any mathematical calculations that are impossible.
In: Computer Science
Java/JavaFX: Write up some simple sample code to demonstrate indirect recursion. You can just use print statements to demonstrate how they call one another.
Submit your working .java file here for credit.
In: Computer Science
***************************************************** * USE UBUNTU (Linux) TERMINAL MODE COMMANDS ONLY * * DO NOT USE ANY EDITORS TO CREATE THIS PROGRAM * ***************************************************** 1) Create a file called lastNameFirstNameInitialpgm3.sh ex: robinsonMpgm1.sh 2) Append to the above file the necessary commands that when this file is executed it will display the following: - Using your own set of multi-line comments enter your program identification as described in the Syllabus, example: <<ID ************************************************** Author : Your Name Course : Course Name and Times Professor: Michael Robinson Program : Program Number, Purpose/Description A brief description of the program Due Date : mm/dd/yyyy I certify that this work is my own alone. ************************************************** ID - Append to the file the following commands that when this file is executed it will do the following: 1) Display Hello my name is: 2) Display My user name is: 3) Display Todays date and time is: 4) Display This file has x lines 5) Display This file has x words 6) Display this file has x bytes 7) Display Please enter any number 8) Display Your number $number * 2 = XXX and display press any key to continue 9) Display a new clean screen 10) Display Enter a line of numbers to be added 11) Using enhanced for loop, display all numbers entered delaying the output of each number by 1 second each and then the total of adding thoses numbers: ex: 20 5 3 = 28 12) Using a while true loop request, accept and display data until it ends on input mod 5 = 0 using -lt and -gt comparison commands this uses if else
In: Computer Science
In: Computer Science
Instead of using two different variables, however, we will
define a structure with two members; one representing the feet and
the other one representing the inches. We will also use three
functions; one to initialize a structure, another one to check the
validity of its values, and one last one to print them out.
First, go ahead and define your structure. Next, declare a
structure of this type inside the main. Then, call your first
function (the initialization function). This function will be of
type structure, it will receive zero parameters and it will return
a structure. Inside the function, ask the user for the height of
the student. In other words, you will use this function to
initialize the structure you have in the main. When done, call a
second function (the checking function). To this function, you will
send your structure. The function will not return anything and it
will validate the values inputted by the user. If any of the values
is not in the right range (between 5’ 8” and 7’ 7”), display an
error message and exit the program. Make sure to also check for
negative values.
Lastly, if the program didn’t exit, call the last function (the
printing function). This function will receive a structure, it will
not return anything and it will display the values of the two
members of the structure.
Use C code to solve this problem.
In: Computer Science
Compare and contrast the functionalities of TCP wrappers and a firewall.
In: Computer Science
Your organization has created a data-sharing partnership with another business. Management of both organizations has decided they want to share data between their networks via FTP. Data sharing will occur between known, existing servers on each side of the network. You have been asked to devise a firewall-specific strategy to facilitate this new connection. What strategy
would you recommend, and why?
Your answer should be approximately 200-250 words in length
In: Computer Science