Questions
In this exercise, you will create a basic data management system for students in the Department...

In this exercise, you will create a basic data management system for students in the Department of Computer Science and Information Technology using the linked list.

You must write two classes – Student class attached, and StudentChart.

Student class consists of student data. StudentChart class contains a linked list of all students in the department.

For this purpose, you must fulfill the following interfaces (note - fields of the objects should be marked as private).

Class: Student chart

Class of Student Chart contains data for all students stored in a linked list. The way to add a student to the list by method addStudent only to the front of the list. At the beginning the student list is empty, the number of students enrolled in the Department is 0. Think what would be the fields of this class, so that you can know much information at any one time.

Constructors:

Creat the class chart according to the private

StudentChart()

.fields(variables).

Methods:

Return type

Method name and parameters

operation

Add student to the front of the linked list.

void

addStudent(Student student

Delete student from the list. Do nothing if the student does not exist in the list. Returns false if student not found in the list

boolean

deleteStudent(Student student)

int

getNumOfStudents()

Returns the number of students in the list.

boolean

isStudent(Student student)

Examine if student exists in the list.

Student

getStudent(int studentNum)

Returns students data for the students with studentNum.

Returns the student average in the course with number

double

getAverage(int course)

course

Returns student average in all courses for all students.

double

getAverage()

(You can use the Student class methods).

Prints the students data for all students as follow:

Student number 1:

<Student String representation> Student number 2:

<Student String representation>

Student number <n>:

<Student String representation> If there are no students print:

void

printStudentChart()

No students!

It is recommended to write tester to present all the methods of the class and to check that they actually work.

The student class :

public class Student {
   private String name;// student name
   private long id; // student identity number
   private int [] grades = new int[5]; // list of student courses grades
   
   //costructor that initialize name and id
   public Student(String name, long id){
       String n = name.toUpperCase();
       name = name.replace(name.charAt(0), n.charAt(0));
       for(int i=0 ; i<name. length(); i++)
           if(name.charAt(i)==' ')
               name = name.replace(name.charAt(i+1), n.charAt(i+1));
       this.name = name;
       this.id=id;
       
   }
   
   //copy constructor
   public Student(Student st){
       this.name= st.name;
       this.id = st.id;
   }
   
   //return the student name
   public String getName(){
       return name;
   }
   //returns the student id number
   public long getId(){
       return id;
   }
   
   // returns the course grade accoring to parameter course(course number) 
   public int getGrade(int course){
       if(grades[course]== 0)
           return -1;
       return grades[course];
       
   }
   // set the name of student with parameter name
   public void setName(String name){
       String n = name.toUpperCase();
       name = name.replace(name.charAt(0), n.charAt(0));
       for(int i=0 ; i<name. length(); i++)
           if(name.charAt(i)==' ')
               name = name.replace(name.charAt(i+1), n.charAt(i+1));
       this.name = name;
       
   }
   
   //sets the student id with parameter id
   public void setId(long id){
       this.id = id;
   }
   //set the course grade with parameter grade 
   public void setGrade(int course, int grade){
       grades[course]= grade;
   }
    // set all the grades of the student from user
   public void setGrades(int [] g){
       for(int i=0; i< grades.length; i++)
           grades[i]=g[i];
            
   }
   //returns the student average in his course
   public double getAverage(){
       int sum= 0;
       int count =0;
       for(int i=0; i< grades.length; i++){
           if(grades[i]!=-1)
          sum=+ grades[i];
           count++;
       }
       return sum/count*1.0;// compute and return average
       
   }
   
   // takes a student object as a parameter and 
   // return true if it is the same as student parameter
   public boolean equals(Student student){
       if(student.id== this.id)
           return true;
       else
           return false;
   }
   //returns a string that represents the student object
   public String toString(){
       
       String [] g = new String[5];
       for(int i=0; i< grades.length; i++)
           if(grades[i]!= -1)
               g[i]= grades[i]+" ";
               else
               g[i]="no grade";
              
       String n1= "Name:"+ name+"\n"+ "ID:  "+ id +"\n"+ "Grades:"+"\n"+
               "Introduction to Programming - "+g[0] +"\n"+"Introduction to Management – "+g[1]+"\n"+
               "Data Structures – "+g[2]+"\n"+"Introduction to Economics – "+g[3]+"\n"+
               "Introduction to Mathematics – "+g[4];
       
       return n1;               
   }
    
}

In: Computer Science

public static BagInterface<String> intersection (BagInterface<String> bagA, BagInterface bagB) This method must return a new bag which...

public static BagInterface<String> intersection (BagInterface<String> bagA, BagInterface bagB)

This method must return a new bag which is the intersection of the two bags: bagA and bagB. An element appears in the intersection of two bags the minimum of the number of times it appears in either. For example, {1,1,2} ∩{1,1,2,2,3}= {1,1,2}. Do not forget to state the big Oof your method implementation.

two file java main and test

by netbeans java

data structure and algorithem

In: Computer Science

C Programming Language Question The following program sums up a number from a user input argv[1]...

C Programming Language Question

The following program sums up a number from a user input argv[1] by using a single thread. For example, argv[1] of 100 is going to give us a sum of 5050 using just a single thread.

I need to modify it so that it takes 2 command lines args, argv[2] for number of threads. In other words, the program needs to use multi-threads to solve it. The number of threads is going to divide the work between them and then join together to sum the numbers.

For example, a command line of 100 10 will give us a sum of 5050 using 10 threads.

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

int sum; // this data is shared by the threads
void *runner(void *param); // threads call this function

int main(int argc, char *argv[])
{
pthread_t tid; // thread identifier
pthread_attr_t attr; // set of thread attributes

// set the default attributes of the thread
pthread_attr_init(&attr);
// create the thread
pthread_create(&tid, &attr, runner, argv[1]);
// wait for the thread to exit
pthread_join(tid, NULL);

printf("Sum = %d\n", sum);
}

void *runner(void *param)
{
int i, upper = atoi(param);
sum = 0;

for (int i = 1; i <= upper; i++)
sum += i;

pthread_exit(0);
}

In: Computer Science

IN JAVA Create an array and add random values to it, and then find the sum...

IN JAVA

Create an array and add random values to it, and then find the sum of the values using recursion.

In: Computer Science

Answer the following questions about computer operating systems: 1. Which of the following conditions must exist...

Answer the following questions about computer operating systems:

1.

Which of the following conditions must exist for deadlock to occur?

Group of answer choices

All of these.

No preemption

Circular wait

Hold and wait

Mutual exclusion

2.

Which of the following is not a method for dealing with deadlock?

Group of answer choices

deadlock prevention

deadlock deletion

deadlock detection and recovery

deadlock avoidance

3.

A state where deadlock might occur is known as a(n) ________________.

Group of answer choices

safe state

dead state

unsafe state

critical state

4.

A resource allocation graph can indicate if deadlock might occur if there is a _______________ in the graph.

Group of answer choices

bear

cycle

detached subgraph

petri net

In: Computer Science

The best IT support technicians are the ones who continually teach themselves new skills. You can...

The best IT support technicians are the ones who continually teach themselves new skills. You can teach yourself to use and support Windows by using the web, a couple of apps in Windows 10 called Get Help and Tips, or the Windows Help and Support utility in Windows 8/7. To start the apps in Windows 10, type get help in the search box or type tips in the search box. In Windows 8, type Help and Support on the Start screen. In Windows 7, click Start and then click Help and Support. If you are connected to the Internet, clicking links can take you to the Microsoft website, where you can find information and watch videos about Windows.

Do the following to research a topic so you can become an independent learner about Windows:

1. The Windows 10/8/7 Snipping Tool can help you take screenshots of the Windows desktop. These screenshots are useful when documenting computer problems and solutions. Use Get Help or Windows Help and Support to find out how to use the Snipping Tool. Use it to take a screenshot of your Windows desktop. Save the screenshot into a file on a USB flash drive or on the hard drive. Print the file contents.

2. Access the support.microsoft.com website for Windows support. Save or print one article from the Knowledge Base that addresses a problem when installing Windows 10/8/7.

3. Search the web to learn the purpose of the pagefile.sys file. What website did you use to find your answer? Why is the Microsoft website considered the best source for information about the page file sys file?

In: Computer Science

In Real Problem 10-1, you installed VirtualBox and created a VM. In this project, you install...

In Real Problem 10-1, you installed VirtualBox and created a VM. In this project, you install Ubuntu Desktop, a popular Linux distro (short for distribution). Complete the following steps:

a. Go to ubuntu.com and download the Ubuntu Desktop OS to your hard drive. This is a free download, so you can decline to make any donations. The file that downloads is an ISO file. Ubuntu is a well-known version of Linux that offers both desktop and server editions.

b. Open VirtualBox. Select the VM and click Settings. In the VM’s Settings box, click Storage in the left pane. In the Storage Devices area, to the right of Controller: SATA, click the Adds optical drive icon, which looks like a disc with a green (+) symbol on it, as shown in Figure 10-59.

c. A dialog box appears. Click Choose Disk. Browse to the location of the ISO file that contains the Ubuntu desktop operating system setup files. Select the ISO file, click Open and then click OK. You will return to the Oracle VM VirtualBox Manager window.

d. With the VM selected, click Start on the toolbar. Your VM starts up and begins the process of installing the operating system. Click Install Ubuntu. Follow the prompts and accept all default settings. If given the option, don’t install any extra software bundled with the OS. You’ll need to restart the VM when the installation is finished. When prompted to remove the installation media, press Enter because the ISO file was automatically removed already.

e. In the welcome windows, read about Ubuntu and skip the Livepatch setup. Install any OS updates offered. Monitor the update by clicking the Software Updater app in the dock and restart when it’s ready. To verify that you have an Internet connection, open the Mozilla Firefox browser and surf the web.

f. Good IT technicians must know how to use many operating systems. Poke around in the Ubuntu desktop interface to get familiar with it. You can also search the web for tutorials videos on how to use Ubuntu Desktop. How do you open the Settings app to change settings in the OS, such as background-image, notifications, privacy, and network connections?

g. When you’re ready to shut down your VM, click the power icon in the upper-right corner of your screen, click the next power icon and click Power Off in the menu that appears. As with physical computers, it’s important to properly shut down the VM correctly to prevent the corruption of its OS and other files.

In: Computer Science

N/B: THE PROGRAMME SHOULD BE WRITTEN IN JAVA LANGUAGE CS 202 Part 1. Create a class...


N/B: THE PROGRAMME SHOULD BE WRITTEN IN JAVA LANGUAGE
CS 202
Part 1.
   Create a class called Loan.  An instance of the class can be used to calculate
   information about a bank loan.  
   
   The class should have the following methods:
   
   a. A constructor  that is passed the amount being borrowed, the annual interest
      rate and the number of years for repayment.
      
   b. A default constructor that initializes the amount being borrowed, the annual 
      interest rate and the number of years for repayment to 0.
      
   c. "get" methods (accessors) for the loan amount, the annual interest rate and the 
       number of years for repayment.
   
   d. "set" methods (mutators) for the loan amount, the annual interest rate and the 
      number of years for repayment.
   
   e. A method that calculates and returns the amount of the monthly payment for
      the loan.
      The monthly payment on a loan can be calculated using the following formula:


                             loanAmount * R
      monthly payment =     --------------------
                                        -N
                           1 -  (1 + R )
                        
      R = monthly rate of interest for the loan
      N = number of months to repay the loan
      
   
   
   f. A method that returns the sum of all payments needed to repay the loan.
   
   g. A method that returns the sum of all interest paid on the loan.
   
   
Part 2.   
   Write an application that tests the Loan class.  The program should allow the user to
   create a loan, enter information about the loan and make changes to the amount of
   the loan, the interest rate, and the number of years to repay the loan.
   

In: Computer Science

C++(OOP)plz SOLVE THE PROBLEM ACCORDING TO INSTRUCTIONS Imagine you are on a trip around Europe and...

C++(OOP)plz SOLVE THE PROBLEM ACCORDING TO INSTRUCTIONS
Imagine you are on a trip around Europe and have collected currencies from
the different countries that you have travelled.
You are to write a simple money counting program. Your program will be able
to deal in the following three currencies
a) Pakistani Rupee
b) Turkish Lira
c) Pound Sterling
 You must make a class called Currency. Create its data members and any
member functions you require. Your class should be written such that you
are able to execute statements like these in your main function:
C_Sum =100 C1 + 11 (C2) + 56 (C3)
where C1, C2 and C3 represent different currency bank notes.
% C1 - displays C1 amount in all three currencies.
C1 [“pkr”]– displays the C1 amount in PKR along with the date and current
exchange rate of the input currency with pkr.
C1 [“gbp”]– displays the C1 amount in Pound Sterling along with the date and
current exchange rate between the input currency and pounds.
A FEW GUIDELINES
 This question involves operator overloading and needs to be
accomplished using classes.
 Your main function must be as small as possible. This implies you must
use class constructors and class functions to accomplish everything in assignment
Make a separate class called Conversion_Rate. Use constructors to take
inputs for the exchange rate for the day. Display them every time you
display the total sum.
 Every time you perform a money conversion, your program must contact
the Conversion_Rate class class to provide the exchange rates for the
given day. You are to apply the concept of friend functions/ friend
classes (as you need) to allow this class to share its information.

In: Computer Science

This project involves writing a program to simulate a blackjack card game. You will use a...

This project involves writing a program to simulate a blackjack card game. You will use a simple console-based user interface to implement this game. A simple blackjack card game consists of a player and a dealer. A player is provided with a sum of money with which to play. A player can place a bet between $0 and the amount of money the player has. A player is dealt cards, called a hand. Each card in the hand has a point value. The objective of the game is to get as close to 21 points as possible without exceeding 21 points. A player that goes over is out of the game. The dealer deals cards to itself and a player. The dealer must play by slightly different rules than a player, and the dealer does not place bets. A game proceeds as follows: A player is dealt two cards face up. If the point total is exactly 21 the player wins immediately. If the total is not 21, the dealer is dealt two cards, one face up and one face down. A player then determines whether to ask the dealer for another card (called a “hit”) or to “stay” with his/her current hand. A player may ask for several “hits.” When a player decides to “stay” the dealer begins to play. If the dealer has 21 it immediately wins the game. Otherwise, the dealer must take “hits” until the total points in its hand is 17 or over, at which point the dealer must “stay.” If the dealer goes over 21 while taking “hits” the game is over and the player wins. If the dealer’s points total exactly 21, the dealer wins immediately. When the dealer and player have finished playing their hands, the one with the highest point total is the winner. Play is repeated until the player decides to quit or runs out of money to bet. You must use an object-oriented solution for implementing this game.

Each public class must be contained in a separate Java source file. Only one source file will have a main() method and this source will be named BlackjackGameSimulator.java. Other source/class names are up to you following the guidelines specified so far in the course. The format of the Java source must meet the general Java coding style guidelines discussed so far during the course. Pay special attention to naming guidelines, use of appropriate variable names and types, variable scope (public, private, protected, etc.), indentation, and comments. Classes and methods should be commented with JavaDoc-style comments (see below). Please use course office hours or contact the instructor directly if there are any coding style questions. JavaDocs: Sources should be commented using JavaDoc-style comments for classes and methods. Each class should have a short comment on what it represents and use the @author annotation. Methods should have a short (usually 1 short sentence) description of what the results are of calling it. Parameters and returns should be documented with the @param and @return annotations respectively with a short comment on each. JavaDocs must be generated against every project Java source file. They should be generated with a - private option (to document all protection-level classes) and a –d [dir] option to place the resulting files in a javadocs directory/folder at the same level as your source files.

In: Computer Science

Implementation of Quick sort and heap sorting algorithms in C++

Implementation of Quick sort and heap sorting algorithms in C++

In: Computer Science

When should you use the String Class as opposed to the StringBuilder Class? Describe why this...

When should you use the String Class as opposed to the StringBuilder Class? Describe why this answer is logical.

In: Computer Science

Using the python program language. Expand/EDIT the code below for all vowels (AEIOU). Please provide a...

Using the python program language. Expand/EDIT the code below for all vowels (AEIOU). Please provide a code and a screen shot of the code working with an output. the code should be able to take any name as an  input. The code should be able to pull out the vowels along with the count fo each vowel within that name for the output.

#countVowels.py
import sys

s1 = str(sys.argv[1])
(a,e,i,o,u) = (0,0,0,0,0)
print ("String length = ", len(s1))
for n in range(0, len(s1)):
if (s1[n] == 'a'):
a += 1
elif s1[n] == 'e':
e += 1

print ("a count = ", a)
print ("e count = ", e)
c = len(s1) - a - e
print ("Consonants count ", c)

In: Computer Science

Our Client, a renowned trading company, suffered a sudden, devastating power outage that caused their server...

Our Client, a renowned trading company, suffered a sudden, devastating power outage that caused their server to cease functioning. The company took the hard-drive to a local computer repair company that was unable to read the corrupt drive. At this point, the company contacted you, a forensics consultant, to recover the information. What actions will you take? Provide 5 specific steps and explain how these actions will help.

In: Computer Science

Answer the questions in full 1: What field in the IP header can be used to...

Answer the questions in full

1: What field in the IP header can be used to ensure that a packet is forwarded through no more than N routers?

2: Do routers have IP addresses? If so, how many?

3: Suppose you wanted to implement a new routing protocol in the SDN control plane. At which layer would you implement the protocol? Explain

In: Computer Science