(C++ with main to test)
2.2
Task 1
You are going to implement a variant of the standard linked list,
the circular list. The
circular linked list is a variant of the standard linked list that
wraps around so that
traversals through the list will wrap around to the beginning
instead of simply reaching
the end. This will consist of implementing two classes: cLL and
item.
2.2.1
cLL
The class is described according to the simple UML diagram
below:
2cLL<T>
-head:item<T> *
-size:int
------------------------
+cLL()
+~cLL()
+isEmpty():bool
+getSize():int
+push(newItem: item<T>*):void
+pop():item<T>*
+getMaxItem():T
+getMinItem():T
+peek(): item<T> *
+printList():void
The class variables are as follows:
• head: The head pointer for the linked list.
• size: The current size of the circular linked list. It starts at
0 and grows as the list
does.
The class methods are as follows:
• cLL: The constructor. It will set the size to 0 and initialise
head as null.
• ∼cLL: The class destructor. It will iterate through the circular
linked list and
deallocate all of the memory assigned for the items.
• isEmpty: This function returns a bool. If the circular linked
list is empty, then it
will return true. Otherwise, if it has items then it will return
false.
• getSize: This returns the current size of the circular linked
list. If the list is empty
the size should be 0.
• push: This receives a new item and adds it to the circular linked
list. It is added to
the front of the list. The front being the head of the list.
• pop: This receives, and returns, the first element in the list.
The first element is
removed from the list in the process. If the list is empty, return
null. The first
element referring to the head pointer in this case.
• peek: This function returns the first element in the list but
does not remove it, first
being the head item.
• getMaxItem: This will return the value of the item in the
circular linked list which
is the maximum for the list.
• getMinItem: This will return the value of the item in the
circular linked list which
is the minimum for the list.
3• printList: This will print out the entire list from head
onwards. Importantly, each
item is listed on one line with commas delimiting each item. For
example,
1.2,1.3,1,4,5,6
Remember to add a newline at the end.
2.2.2
item
The class is described according to the simple UML diagram
below:
item <T>
-data:T
-------------------
+item(t:T)
+~item()
+next: item*
+getData():T
The class has the following variables:
• data: A template variable that stores some piece of
information.
• next: A pointer of item type to the next item in the linked
list.
The class has the following methods:
• item: This constructor receives an argument and instantiates the
data variable with
it.
• ∼item: This is the destructor for the item class. It prints out
”Item Deleted” with
no quotation marks and a new line at the end.
• getData: This returns the data element stored in the item.
You will be allowed to use the following libraries:
cstdlib,string,iostream.
In: Computer Science
Write a shell script of the following: “A Multiple Choice Question that contains 5 questions and each question carries 2 options. Choice will be given by the students. A record file is created each time the script runs to store the answers along with the total marks obtained. The record filename that has date and timing information as well as the student name.
In: Computer Science
I need this before the end of the day and in java please :)
10.12 Lab 9
In BlueJ, create a project called Lab9
A car dealership pays their salesmen a base salary every month. However, based on how many cars they sold (qtySold) they get a percentage of their salary as a bonus. To determine the percent bonus, the company uses the following chart.
| qtySold | %Bonus |
|---|---|
| 5 or less | 0% |
| More than 5 but 10 or less | 5% |
| More than 10 but 15 or less | 10% |
| More than 15 | 15% |
Create a class called Employee as described in the following UML
| Employee |
|---|
| - lastName: String - qtySold: int - basePay: double |
| +Employee() +Employee(name: String, qtySold: int basePay: double) +setLastName(name: String):void +setQtySold(qtySold: int):void +setBasePay(basePay: double): void +getLastName(): String +getQtySold: int +getBasePay(): double +computePercentBonus(): int +calculatePay():double |
NOTE: test methods as you implement them
Create a text file using notepad. Save the text file in your Lab9 project folder and call it empData.txt. Copy the data below into the file. Save the file.
Tetzner 7 425.85 Martin 3 530.90 Smith 20 470.45 Jones 12 389.74 Glembocki 10 412.74
Create a class called Main
import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException;
System.out.printf("%-10s%8s%10s%8s%12s%n", "Name","Qty Sold","Base Pay","%Bonus","Total Pay");
When you are done, upload the Employee class and the Main class to zybooks and submit it.
Sample Output
Name Qty Sold Base Pay %Bonus Total Pay Tetzner 7 425.85 5 447.14 Martin 3 530.90 0 530.90 Smith 20 470.45 15 541.02 Jones 12 389.74 10 428.71 Glembocki 10 412.74 5 433.38 The company paid out a total of $2381.15 this week Top seller this week sold 20 cars
In: Computer Science
In: Computer Science
Phython:
Given a string x, write a program to check if its first character is the same as its last character. If yes, the code should output "True"
In: Computer Science
Ubuntu, Linux, MacOS use one of these systems.
1a. Create a C program that forks a child process that executes the
command ‘ls’.
1b. Extend the program you created in Problem 1a such that it takes
an argument. For example, the created child process should be able
to execute the command ‘ls’ with any arbitrary single argument such
as ‘ls -l’, and ‘ls -a’.
In: Computer Science
Java Hash table,
What does the separate chaining ST look like for M=3 and the following input key, hash pairs? A,0 F,0 Z,2
In: Computer Science
Make a copy of the /etc/services file in your home folder. How many times the string “tcp” appear in the file? Provide a screen shot below:
How would you add your account to the wheel group, in the /etc/group file using a one line command? Provide a screen shot below:
In: Computer Science
Interaction styles are methods to communicate between users and machines through user interface. List four types of interaction styles with at least two strengths and limitations of each style. Also present one example screenshot of each interaction style
In: Computer Science
Draw the activity diagram for teledermatology
Teledermatology :
From the word Teledermatology that comes from two words 'Tele' and 'Dermatology' which denotes the way of e-health. Tele means the communication and here the cometmunication is made through the server between the doctors and the patients.The doctors are mainly the skin doctors means dermatologist. In this field, telecommuncation technologies are being used to transfer medical information over varying distances through audio, visual and data communication.Applications of teledermatology span different areas of health care management such as consultation, diagnoses, treatment and even education.
Telemedicine describes the application of information and communication technologies in the entire range of functions that involve the health sector. Several medical and surgical specialties utilize tele-consultation. It is a sub specialty in the medical field of dermatology and probably one of the most common applications of tele-medicine and e-health.Teledermatology relieves the primary care physician of the responsibility of making the wrong call about serious skin ailments. It’s well known that stress can make these conditions worse, so eliminating a long drive may be just what the doctor ordered. Teledermatology embraces great potential for revolutionizing the delivery of dermatologic services to remote and distant locations by means of telecommunications and information technology. It encompasses consultations between a patient (and the primary healthcare provider) and a dermatologist for diagnosis and management advice. Teledermatology also covers dermatological education for health professionals and for consumers. Teleconsultations reduce time and increase the chances of access to one or more consultants as the patient or referring doctor desires, irrespective of the distance between the two. Its usefulness in the field of surgery and aesthetic surgery is immeasurable as there are only a few experts in the field of aesthetic surgery available currently in comparison to the dermatology population and the ever growing awareness and demand of the patients towards aesthetics.
Advantages of this Model are Patients can view their health records and prescriptions on their mobile phones on a request basis .It can also be used to share information seamlessly and in near-real-time across devices and other organizations. In this cloud model, customer providers only pay for what they use.It offers remote access allows data sharing between authorized units the updates for the medical history of the patient - consultations, prescriptions, hospitalization - are made in real time and are useful for future treatment validation.
Complete activity diagram from teledermatology---
Teledermatology services are based in this architecture. There is a server application which stores and makes available the incoming skin images from the patients. The client, in its turn, is responsible for acquiring data from patient transmitting them through Internet.Health care Administrator monitors their patients using the server application. Also, data can be exported to XML files or printed. In the application of telemedicine, the medical information usually needs to be distributed among medical doctors and display, archival, and analysis devices .Therefore, the server side was developed with the purpose of receiving, storing and distributing the vital sign data from patients.It was developed under Java technology too. So, any classes were reutilized. Basically, the server is composed of a Java application and a relational database(MySQL).
There is a incredible assure for cloud computing infrastructure in the healthcare industry. Cloud computing would help healthcare centers to achieve efficient use of their hardware and software investments and to increase profitability by improving the exploitation of resources to the maximum. The purpose of implementing cloud computing systems in health care is not to compete with each other but serves to facilitate and improve the excellence of patient care. When a health organization considers moving its service into the cloud, it needs strategic planning to examine environmental factors such as staffing, budget, technologies, organizational culture, and government regulations that may affect it, assess its capabilities to achieve the goal, and identify strategies designed to move forward.
In: Computer Science
11. First and Last Design a program that asks the user for a
series of names (in no particular order). After the final person's
name has been entered, the program should display the name that is
first alphabetically and the name that is last alphabetically. For
example, if the user enters the names Kristin, Joel, Adam, Beth,
Zeb, and Chris, the program would display Adam and Zeb.
#Sentinel value is DONE
SENTINEL = "DONE"
ls = []
prompt = "Enter a name, or enter DONE to quit."
newLs = input(prompt)
n = newLs
#test for sentinel
while newLs != SENTINEL:
ls.append(newLs)
newLs = input(prompt)
#sort in alphabetical
for i in range(n) :
name = int()
ls.append(name)
ls.sort()
print('{} and {}'. format(ls[0],ls[n-1]))
I need help with sorting the names from the sentinel loop so that I
get only two outputs that are alphabetically ordered
In: Computer Science
In: Computer Science
QUESTION 1
User can interact with a PC using a command-line interface by issuing commands to the program in the form of successive lines of text.
True
False
1 points
QUESTION 2
A machine code (object code) is generated by an executor for process.
True
False
1 points
QUESTION 3
In case of all the resources are being used, the new process with a low priority might not get its resource forever.
True
False
1 points
QUESTION 4
A computer can understand source code and directly executes it.
True
False
1 points
QUESTION 5
Solaris always comes with both CLI and GUI.
True
False
1 points
QUESTION 6
In most cases, API is used for system calls.
True
False
1 points
QUESTION 7
In the parameter passing, LPDWORD indicates the size of the data to be read.
True
False
1 points
QUESTION 8
Layered structure is well protected but not efficient.
True
False
1 points
QUESTION 9
A program trying to create a file with a certain name, what will the program do if there is a file with the same name already exist in the directory.
|
Abort and ask the user to input a new title. |
||
|
Delete the existing file and create a new file |
||
|
Move the existing file into another directory |
||
|
None of them |
1 points
QUESTION 10
In Unix, which three system calls are responsible for protecting the files.
|
chmod() mmap() chown() |
||
|
fork() ioctl() chown() |
||
|
chmod() pipe() umask() |
||
|
None of them |
1 points
QUESTION 11
Name the best OS structure and its inherited structures.
|
Modular and inherits Monolithic and Layered structures. |
||
|
Monolithic and inherits layered and Modular structures. |
||
|
Microkernel and inherits Monolithic and UNIX structures. |
||
|
Modular and inherits Microkernel and Layered structures. |
1 points
QUESTION 12
An operating system service that deal with internet and message passing between systems.
|
LAN |
||
|
Communication |
||
|
Internet and file manager |
||
|
Network operating systems |
1 points
QUESTION 13
Operating system service, which ensures that the data have not been corrupted in transit.
|
Communication |
||
|
Buffer |
||
|
Trap |
||
|
Error-detection |
1 points
QUESTION 14
A guest OS can be hosted by an OS using _____.
|
Virtual Machines |
||
|
Virtual Memory |
||
|
Virtual Reality |
||
|
Virtual Codes |
1 points
QUESTION 15
A structure where its kernel can add or remove functions.
|
Modular |
||
|
Microkernel |
||
|
Layered |
||
|
Monolithic |
1 points
QUESTION 16
The top layer (layer N) in the layered OS structure.
|
Memory |
||
|
Kernel |
||
|
Hardware |
||
|
User interface |
1 points
QUESTION 17
_________ makes sure not to happen a scenario that processes keep waiting for a certain resource but never get it.
In: Computer Science
Test all of the methods in the code below:
Instantiate several Matrix objects of different sizes.
Make a Matrix copy from an excisting Matrix
Test the equals method to show one matrix being equal and one matrix not being equal
display 2 matrices using a toString method
display a mtrix object before and after multiplying by a scalar after
display a matrix object before and after multiplying by 0
test the matrix by matrix multiplication with at least 3 different matrix objects that test different outcomes of the method including the exception
Source Code:
public class Matrix {
private int rows, columns;
private int[][] data;
public Matrix(int r, int c) {
data = new int[r][c];
rows = r;
columns = c;
}
public Matrix copyMatrix() {
Matrix m = new Matrix(rows, columns);
for(int i = 0; i < rows; i++)
for(int j = 0; j < columns; j++)
m.data[i][j] = data[i][j];
return m;
}
public boolean equals(Matrix m) {
if(rows == m.rows && columns == m.columns) {
for(int i = 0; i < rows; i++) {
for(int j = 0; j < columns; j++) {
if(m.data[i][j] != data[i][j])
return false;
}
}
return true;
}
else
return false;
}
public String toString() {
String s = "";
for(int i = 0; i < rows; i++) {
for(int j = 0; j < columns; j++) {
s += String.format("%5d ", data[i][j]);
}
s += "\n";
}
return s;
}
public void scalarMultiply(int k) {
for(int i = 0; i < rows; i++)
for(int j = 0; j < columns; j++)
data[i][j] *= k;
}
public Matrix multiply(Matrix m) {
if(columns != m.rows) //can't perform multiplication
return null;
Matrix A = new Matrix(rows, m.columns);
for(int i = 0; i < rows; i++) {
for(int j = 0; j < m.columns; j++) {
for(int k = 0; k < columns; k++)
A.data[i][j] += data[i][k] * m.data[k][j];
}
}
return A;
}
public void set(int r, int c, int val) {
if(r >= 0 && r < rows && c >= 0 && c < columns)
data[r][c] = val;
}
}In: Computer Science
List 4 different types of memories according to the hierarchy (lowest to the highest). What is the advantage and disadvantage of each one of them?
In: Computer Science