Testing_Correlations
.m
keyboard_arrow_up
School
University of Texas, San Antonio *
*We aren’t endorsed by this school
Course
1173
Subject
Computer Science
Date
Dec 6, 2023
Type
m
Pages
2
Uploaded by ChiefEnergyOstrich21 on coursehero.com
%% Example 1
load("DaphneIsland.txt");
%% Example 2
ChildBeakSize = DaphneIsland(:,1);
MotherBeakSize = DaphneIsland(:,2);
FatherBeakSize = DaphneIsland(:,3);
[h1, p1, c1] = ttest(FatherBeakSize, 10);
fprintf(['Do the Father Beak Sizes average 10 mm?\n\t' ...
'h = %g, p = %g, ci = [%g, %g]\n'], h1, p1, c1);
%% Exercise 1
ChildBeakSize = DaphneIsland(:,1);
MotherBeakSize = DaphneIsland(:,2);
FatherBeakSize = DaphneIsland(:,3);
[h2, p2, c2] = ttest(MotherBeakSize, 10);
fprintf(['Do the Mother Beak Sizes average 10 mm?\n\t' ...
'h = %g, p = %g, ci = [%g, %g]\n'], h2, p2, c2);
% Null Hypothesis: Mother Beak sizes average 10mm
% Alternate Hypothesis: Mother Beak size are NOT 10mm
% Significance Level: .09 or 9%
% The null hypothesis is accepeted
%% Example 3
[h3, p3, c3] = ttest2(MotherBeakSize,FatherBeakSize);
fprintf(['Do the Mother and Father have similar Beak Sizes?\n\t'...
'h = %g, p = %g, ci = [%g, %g]\n'], h3, p3, c3);
%% Exercise 2
[h4, p4, c4] = ttest2(MotherBeakSize,ChildBeakSize);
fprintf(['Do the Mother and Father have similar Beak Sizes?\n\t'...
'h = %g, p = %g, ci = [%g, %g]\n'], h4, p4, c4);
% Null Hypothesis: Average Mother and Child Finches beaks are similar
% Alternate Hypothesis: Average Mother and Child Finches Beak sizes are NOT similar
% Significance Level: .10 or 10%
% The null hypothesis is accepeted
%% Example 4
parent = mean(DaphneIsland(:, 2:3), 2);
% Average the parent beak sizes
pCorr = corr(parent, ChildBeakSize);
fprintf('Parent-child beak correlation: %g\n', pCorr)
%% Exercise 3
Mother = mean(DaphneIsland(:, 2:3), 1);
% Average the mother beak sizes
pCorr = corr(MotherBeakSize, ChildBeakSize);
fprintf('Mother-child beak correlation: %g\n', pCorr)
Father = mean(DaphneIsland(:, 2:3), 1);
% Average the father beak sizes
pCorr = corr(FatherBeakSize, ChildBeakSize);
fprintf('Father-child beak correlation: %g\n', pCorr)
% The correlation value is greater than .5.
% The Mother-Child Beak size is higher than the Father-Child Beak
% size, indicating that there is a positive correlation as to Mother-Child beak
sizes and to Father-Child Beak sizes.
%% Example 5
tString = ['Daphne island finches (corr = ',
num2str(pCorr) ')'];
figure('Name', tString)
% Put title on the window
plot(parent, ChildBeakSize, 'ko')
% Plot a scatter plot
xlabel('Parent beak size (mm)');
% Label the x-axis
ylabel('Child beak size (mm)');
% Label the y-axis
title(tString);
% Put title on the graph
%% Example 6
% Keep the Figure from Example 4 open on your desktopuse menu bar on the
% figure to complete the following.
% Make the plot editable. (Click Tools->Edit Plot from the Figure Window
% menubar.)
% Add a linear fit line. (Click Tools ->Basic Fitting from the Figure
% Window menubar. Click the linear checkbox in the Basic Fitting dialog box
% and close.)
% Save the figure as a BeakSize.fig (Click File ->Save ->File name:
% BeakSize -> Save)
%% Example 7
pPoly = polyfit(parent, ChildBeakSize, 1);
% Linear fit of parent vs child
fprintf('Model: child = %g*parent + %g\n', pPoly(1), pPoly(2))
%% Exercise 4
pPoly2 = polyfit(MotherBeakSize, ChildBeakSize, 1);
% Linear fit of parent vs
child
fprintf('Model: child = %g*mother + %g\n', pPoly2(1), pPoly2(2))
%% Example 8
pPred = polyval(pPoly, parent);
% Find parent-child relationship
%% Example 9
pError = ChildBeakSize - pPred;
% Actual - predicted by parent's size
%% Example 10
pMSE = mean(pError.*pError);
fprintf('Mean squared prediction error: %g\n', pMSE);
%% Example 11
pRMS = sqrt(pMSE);
fprintf('RMS prediction error: %g mm\n', pRMS)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
def classify(classifier, point): """ return the classification probability for the given point using the given classifier :params: classifier: list of floats, representing the weights for a logistic classifier point: list of values, representing features of a data point. will be same length as list of weights return: float, representing probability that point is from class 1. """ # TODO: implement this! # placeholder; say "50-50" for any point return 0.5
arrow_forward
SO B N SO RS N Ny M S R T e Problem You want an instance to delegate attribute access to an internally held instance possibly as an alternative to inheritance or in order to implement a proxy.
arrow_forward
Help Please:
Write the definitions of the following functions:
setWaitingTime
getArrivalTime
getTransactionTime
getCustomerNumber
of the class customerType defined in the section Application of Queues: Simulation
#ifndef H_SIMULATION
#define H_SIMULATION
#include <fstream>
#include <string>
#include "queueAsArray.h"
using namespace std;
//**************** customerType ****************
class customerType
{
public:
customerType(int cN = 0, int arrvTime = 0, int wTime = 0,
int tTime = 0);
//Constructor to initialize the instance variables
//according to the parameters
//If no value is specified in the object declaration,
//the default values are assigned.
//Postcondition: customerNumber = cN;
// arrivalTime = arrvTime;
// waitingTime = wTime;
// transactionTime = tTime
void setCustomerInfo(int customerN = 0, int inTime = 0,…
arrow_forward
OZ PROGRAMMING LANGUAGE
Exercise 1. (Efficient Recurrence Relations Calculation) At slide 54 of Lecture 10, we have seen aconcurrent implementation of classical Fibonacci recurrence. This is:
fun {Fib X}
if X==0 then 0
elseif X==1 then 1
else
thread {Fib X-1} end + {Fib X-2}
end
end
By calling Fib for actual parameter value 6, we get the following execution containing several calls ofthe same actual parameters.For example, F3, that stands for {Fib 3}, is calculated independently three times (although it providesthe same value every time). Write an efficient Oz implementation that is doing a function call for a givenactual parameter only once.Consider a more general recurrence relation, e.g.:F0, F1, ..., Fm-1 are known as initial values.Fn = g(Fn-1, ..., Fn-m), for any n ≥ m.For example, Fibonacci recurrence has m=2, g(x, y) = x+y, F0=F1=1
arrow_forward
c++ or java or in pseudo code with explaining
note: if anything is unclear or seems left out make an assumption and document your assumption
Implement an algorithm for assigning seats within a movie theater tofulfill reservation requests. Assume the movie theater has the seatingarrangement of 10 rows x 20 seats, as illustrated to the below.The purpose is to design and write a seat assignmentprogram to maximize both customer satisfaction and customersafety. For the purpose of public safety, assume that a buffer of three seats inbetween
Input DescriptionYou will be given a file that contains one line of input for eachreservation request. The order of the lines in the file reflects the order inwhich the reservation requests were received. Each line in the file will becomprised of a reservation identifier, followed by a space, and then thenumber of seats requested. The reservation identifier will have theformat: R####. See the Example Input File Rows section for anexample of the input…
arrow_forward
java Singly linked list
need help with numbers 5 only 1 to 5 is done but they connected 5 is in the picture
1. Create a class called Citizen with the following attributes/variables:a. String citizenIDb. String citizenNamec. String citizenSurnamed. String citizenCellNumbere. int registrationDayf. int registrationMonthg. int registrationYear2. Create a class called Node with the following attributes/variables:a. Citizen citizen b. Node nextNode 3. Create a class called CitizenRegister with the following attributes/variables:a. Node headNodeb. int totalRegisteredCitizens4. Add and complete the following methods in CitizenRegister:a. head()i. Returns the first citizen object in the linked listb. tail()i. Returns the last citizen object in the linked listc. size()i. Returns the totalRegisteredCitizend. isEmpty()i. Returns the boolean of whether the linked list is empty or note. addCitizenAtHead(Node newNode)i. Adds a new node object containing the citizen object information before the…
arrow_forward
Please use java
Part 2. Library Class
Implement a class, Library, as described in the class diagram below.
Library must implement the Comparable interface.
The compareTo() method must compare the branch names and only the branch names. The comparison must be case insensitive.
The equals() method must compare the branch names and only the branch names. The comparison must be case insensitive.
Be sure to test the equals() and compareTo() methods before proceeding.
Library
- state: String
- branch: String
- city: String
- zip: String
- county: String
- int squareFeet: int
- int hoursOpen: int
- int weeksOpen: int
+ Library(state: String, branch: String, city: String, zip: String, county: String, squareFeet: int, hoursOpen: int, weeksOpen: int)
+ getState(): String
+ getBranch(): String
+ getCity(): String
+ getZip(): String
+ getCounty(): String
+ getSquareFeet(): int
+ getHoursOpen(): int
+ getWeeksOpen(): int
+ setState(state: String): void
+ setBranch(branch:…
arrow_forward
C++
implement a class car.car shall have the following membersa member variable model_year of type int.a member variable model_name of type std :: stringa parameterized constructor that takes both member variables as input parametersa function to retrieve model_yeara function for to retrieve model_name
members' visibility must follow the usual convention
overlay the outflow operator (<<) for class car.input follows the format[model_year] [model_name]
output must have format:Model: [model_name], produced: [model_year]
example:input: 2015 PeugeotOutput; Model: Peugeot, produced: 2015
arrow_forward
Draw a class diagram for the parking office class below. Diagram shoukd not be hand drawn.
N.B Parking office class has relations and dependencies with car, customer, parkinglot and parking charge classes.
public class ParkingOffice {String name;String address;String phone;List<Customer> customers;List<Car> cars;List<ParkingLot> lots;List<ParkingCharge> charges;
public ParkingOffice(){customers = new ArrayList<>();cars = new ArrayList<>();lots = new ArrayList<>();charges = new ArrayList<>();}public Customer register() {Customer cust = new Customer(name,address,phone);customers.add(cust);return cust;}public Car register(Customer c,String licence, CarType t) {Car car = new Car(c,licence,t);cars.add(car);return car;}public Customer getCustomer(String name) {for(Customer cust : customers)if(cust.getName().equals(name))return cust;return null;}public double addCharge(ParkingCharge p) {charges.add(p);return p.amount;}public String[]…
arrow_forward
Computer Science
Please refactor the constructors to reduce code duplication using the call this(), with the proper parameter.
Thank you!
LatencyAnalysis(WarpInterface warp) {
this.latencyReport = new Description();
this.program = warp.toProgram();
this.workload = warp.toWorkload();
this.programTable = program.getSchedule();
this.nodeIndex = program.getNodeMapIndex();
}
LatencyAnalysis(Program program) {
this.latencyReport = new Description();
this.program = program;
this.workload = program.toWorkLoad();
this.programTable = program.getSchedule();
this.nodeIndex = program.getNodeMapIndex();
}
arrow_forward
Problem description:1. Below are classes for a project that involves the creation, displaying andevaluation of a polynomial in x. Organize the classes into a project and test theprogram.2. Based on the project, create a project for the same purpose such thatcoefficients of polynomial may be numbers with decimal digits and that theliteral coefficient in each term must be consistent with the other terms (i.e. A term can be added in an existing polynomial only if the literal is the same asthe literal of the existing terms)./*** The following defines a term of an algebraic polynomial that involves only one* literal. 3x^2 is an example of a term where 3 is the coefficient, x is the* literal and 2 is the degree*/public class Term {private int coef; // data member to hold coefficient of a termprivate int degree; // data member to hold the degree of a termprivate char literal; // data member to hold the literal of a term/*** This a constructor that sets coefficient to 0, degree to 0 and…
arrow_forward
Please help answer this Java multiple choice question.
Assume you are a developer working on a class as part of a software package for running artificial neural networks. The network is made of Nodes (objects that implement a Node interface) and Connections (objects that implement a Connection interface). To create a new connection you call the constructor for a concrete class that implements the Connection interface, passing it three parameters: Node origin, Node target, and double weight. The weight is a double that is greater than or equal to 0, and represents how strongly the target node should weigh the input from the origin node. So with a weight of 0.1 the target node will only slightly weight the input from the origin, but with a weight of 725.67 the target node will strongly weight the input. The method throws an IllegalArgumentException. Which of the following are true?
A. All of the above are true.
B. The code:Connection c = new ConvLayerConnection(origin, target,…
arrow_forward
Implement a “Library” class with attributes such as list of books, librarians, timings etc. • Implement functions to search, issue & report over due books
arrow_forward
C++
CHALLENGE ACTIVITY
7.11.2: Constructor overloading.
Write a second constructor as indicated. Sample output:User1: Minutes: 0, Messages: 0 User2: Minutes: 1000, Messages: 5000
arrow_forward
Zack and Aerith are set to be married. Lined up in front of them will be the entourage of their closest friends composed of 5 pairs. Biggs and Jessie will march first. Announce their names by pair using queues (i.e. use print)! Make sure to use enqueue and dequeue methods!
men = ['Zack', 'Cloud', 'Barret', 'Vincent', 'Cid', 'Biggs']
women = ['Aerith', 'Tifa', 'Marlene', 'Lucrecia', 'Yuffie', 'Jessie']
# Example
# "Zack and Aerith!"
# "Cloud and Tifa!"
arrow_forward
Step 1: Inspect the Node.java file
Inspect the class declaration for a doubly-linked list node in Node.java. Access Node.java by clicking on the orange arrow next to LabProgram.java at the top of the coding window. The Node class has three fields:
a double data value,
a reference to the next node, and
a reference to the previous node.
Each field is protected. So code outside of the class must use the provided getter and setter methods to get or set a field.
Node.java is read only, since no changes are required.
Step 2: Implement the insert() method
A class for a sorted, doubly-linked list is declared in SortedNumberList.java. Implement the SortedNumberList class's insert() method. The method must create a new node with the parameter value, then insert the node into the proper sorted position in the linked list. Ex: Suppose a SortedNumberList's current list is 23 → 47.25 → 86, then insert(33.5) is called. A new node with data value 33.5 is created and inserted between 23 and 47.25,…
arrow_forward
VariableReferenceNode.java, OperationNode.java, ConstantNode.java, and PatternNode.java must have their own java classes with the correct methods implemented:
OperationNode: Has enum, left and Optional right members, good constructors and ToString is good
VariableReferenceNode: Has name and Optional index, good constructors and ToString is good
Constant & Node Pattern: Have name, good constructor and ToString is good
Make sure to include the screenshot of the output of Parser.java as well.
arrow_forward
Challenge: Improve Your Spam Classifier [Ungraded] You can improve your classifier in two ways: Feature Extraction: Modify the function extract_features_challenge(). This function takes in a email (list of lines in an email) and a feature dimension B, and should output a feature vector of dimension B. The autograder will pass in both arguments. We provide naive feature extraction from above as an example. Model Training: Modify the function train_spam_filter_challenge(). This function takes in training data xTr, yTr and should output a weight vector w and bias term b for classification. The predictions will be calculated exactly the same way as we have demonstrated in the previous cell. We provide an initial implementation using gradient descent and logistic regression. Your model will be trained on the same training set above (loaded by load_spam_data()), but we will test its accuracy on a testing dataset of emails (hidden from you)
feature_dimension = 512def…
arrow_forward
create a uml class diagram on this code:
from abc import ABC, abstractmethod
class GreyAnatomy(ABC):@abstractmethoddef Tvshow(self):pass
class Grey(GreyAnatomy):def Tvshow(self):print("I am Derek")
class Rank(Grey):def Tvshow(self):print("I am an attending")
class Specialty(Rank):def Tvshow(self):print("I am an neurosurgeon doctor")
G = Grey()G.Tvshow()
R = Rank()R.Tvshow()
S = Specialty()S.Tvshow()
arrow_forward
Create a UML class diagram for the following problem:
The McDonald’s company has several restaurants in Budapest. Each restaurant has a unique ID and an address. They sell cheeseburger for 500 HUF, BigMac for 1000 HUF, and Chicken McNuggets for 800 HUF. All three can be ordered alone or in small, medium, or large menu. The different menus mean French fries and drink in addition. The small menu costs 500 HUF, the medium is 700 HUF, and the large is 1000 HUF in addition.
The customers get a loyalty card from the McDonald’s company which has a unique number. Based on the card, it can be got what kind of foods were ordered by that guest in the different restaurants.
Make it possible to populate this problem: create methods to add new restaurant, customer, loyalty card, and orders related to any of the cards.Is it true that each restaurant of the company has a guest who has spent more than 10000 HUF?How much has a guest spent in a given restaurant?How many guests have spent more than 10000…
arrow_forward
A readinglist is a doubly linked list in which each element of the list is a book. So, you must make sure that Books are linked with the previous prev and next element.
A readinglist is unsorted by default or sorted (according to title) in different context. Please pay attention to the task description below. Refer to the relevance classes for more detail information.
Implement the add_book_sorted method of the ReadingList class.
Assume the readinglist is sorted by title, the add_book_sorted method takes an argument new_book (a book object), it adds the new_book to the readinglist such that the readinglist remain sorted by title.
For example, if the readinglist contain the following 3 books:
Title: Artificial Intelligence Applications Author: Cassie Ng Published Year: 2000 Title: Python 3 Author: Jack Chan Published Year: 2016 Title: Zoo Author: Cassie Chun Published Year: 2000
If we add another book (titled "Chinese History"; author "Qin Yuan"; and published year 1989) to the…
arrow_forward
In PriorityQueue.java, write code for the following new functions:1. public boolean add( PriorityQueueNode x )This function adds a new node x to the priority queue. The node is added tothe heap by comparison of the rating attribute. It involves the “percolateup” process and returns true when finished.
2. public PriorityQueueNode remove( )This function removes the minimum element of the priority queue and returnsit. It involves a call to percolateDown( int hole ).
3. private void percolateDown( int hole )This function takes the position of the next available hole in the priority queueand uses it to bubble the elements through the heap until the heap property isrestored.
4. public void display( )This function prints out a formatted tree representation of the priority queueshowing only the rating of each node. The output should resemble that of atree. Tip: you may use the StringBuilder class and the Stringformat( ) method. Empty nodes in the tree can be replaced with “--”.Example output…
arrow_forward
Using C++
Without Using linked lists:
Create a class AccessPoint with the following:
x - a double representing the x coordinate
y - a double representing the y coordinate
range - an integer representing the coverage radius
status - On or Off
Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off.
Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Add a set function that sets the location coordinates and the range.
Add the following member functions: move and coverageArea.
Add a function overLap that checks if two access points overlap their coverage and returns true if they do.
Add a function signalStrength that returns the wireless signal strength as a percentage. The signal strength decreases as one moves away from the access point location. Represent this with bars like, IIIII. Each bar can represent 20%
Test your class by writing a main function that…
arrow_forward
Using c++
Find student with highest GPA
Complete the Course class by implementing the FindStudentHighestGpa() member function, which returns the Student object with the highest GPA in the course. Assume that no two students have the same highest GPA.
Given classes:
Class Course represents a course, which contains a vector of Student objects as a course roster. (Type your code in here.)
Class Student represents a classroom student, which has three private data members: first name, last name, and GPA. (Hint: GetGPA() returns a student's GPA.)
Note: For testing purposes, different student values will be used.
Ex. For the following students:
Henry Nguyen 3.5 Brenda Stern 2.0 Lynda Robison 3.2 Sonya King 3.9
the output is:
Top student: Sonya King (GPA: 3.9)
#include <iostream>#include "Course.h"using namespace std;
Student Course::FindStudentHighestGpa() { /* Type your code here */}
void Course::AddStudent(Student s) { roster.push_back(s);}
arrow_forward
can you add based on code below to prints the time when the print job from each student started and their waiting time. It also need to calculate the time needed to complete all printing jobs and the average waiting time. all using dynamic queue.
#include <bits/stdc++.h>using namespace std;
struct QNode { int data; QNode* next; QNode(int d) { data = d; next = NULL; }};
struct Queue { QNode *front, *rear; Queue() { front = rear = NULL; }
void enQueue(int x) {
// Create a new LL node QNode* temp = new QNode(x);
// If queue is empty, then // new node is front and rear both if (rear == NULL) { front = rear = temp; return; }
// Add the new node at // the end of queue and change rear rear->next = temp; rear = temp; }
// Function to remove // a key from given queue q void deQueue() { // If queue is empty, return…
arrow_forward
C PROGRAMMING
Phase 1
Each person eligible to win is placed in one of G groups. For each group, a process is used to narrow down the possible number of winners. The process is as follows:Let a group initially start with p people. We can number the people within a group from 1 to p and assume they are arranged in a circle(circular linked list), with 1, then 2, ..., then p, followed by 1. Each group has its own skip number, s, and its own threshold number, t, where t< p. To eliminate some people in a group from possibility of winning the lottery, start at the person labeled 1 and skip over speople in line. Then, remove the following person. (Thus the first person removed is always person number s+1.)Then repeat the process. Since the line is circular, once you pass the highest numbered person left in line, you'll continue to the lowest numbered person left in line. Continue eliminating people in this fashion until there are precisely t people left.
Phase 2
Of all of the people…
arrow_forward
Using C++ define a Robot class and command robot objects to move to differentlocations within an 10X10 grid (or board) to pickup and drop-off loads in different cells of thegrid. The loads are assumed to be characters. For simplicity we assume the grid is a globalvariable. The Robot class must have the following data membersa. A private data field xLocation (an int type) : Holds the x-component of the location ofthe robot object on the gridb. A private data field yLocation(an int type) : Holds the y-component of the location ofthe robot object on the gridc. A private data field cargoBed (a bool type) : Indicates whether the robot has any cargo(load)d. A private data field load (a char type) : Holds the content of the load, set to character ‘.’(a dot) when robot has no load.The class Robot must have the following public functions:a. A constructor that receives parameters to initialize all private date members.b. Include get/set functions for all private data members.2c. The function…
arrow_forward
Association Relationships in Java
Using the revised UML Class diagram Resto Fun Final i posted, continuedeveloping the Resto Fun system by modifying class definitions
Create an Order class to break the Many-To-Many relationship between Customer and Item. Thisis a Relationship Class, a class that contains information on the association between to classes.Implement the relationship WaitsOn between Waiter and Customer, knowing that therelationship indicates that this is a One-to-Many relationship mandatory in both ends, i.e., awaiter must wait on a customer and a customer must be waited on by a waiter.Implement the relationship Orders between Customer (Table) and Item, another One-to-Many,since there are many Items a Customers can order, but each Item ordered is for one customeronly.Implement the Add relationship between Order and Item. Include a method to assign the Orderto a Customer before you start adding Items to the Order!
There is enough information now to implement the…
arrow_forward
Make an interaction diagram for the parking office class below. We have included the class code below. The diagram should not be hand-drawn
Use the class diagram to better understand all classes in our system
public class ParkingOffice {String name;String address;String phone;List<Customer> customers;List<Car> cars;List<ParkingLot> lots;List<ParkingCharge> charges;
public ParkingOffice(){customers = new ArrayList<>();cars = new ArrayList<>();lots = new ArrayList<>();charges = new ArrayList<>();}public Customer register() {Customer cust = new Customer(name,address,phone);customers.add(cust);return cust;}public Car register(Customer c,String licence, CarType t) {Car car = new Car(c,licence,t);cars.add(car);return car;}public Customer getCustomer(String name) {for(Customer cust : customers)if(cust.getName().equals(name))return cust;return null;}public double addCharge(ParkingCharge p) {charges.add(p);return p.amount;}public String[]…
arrow_forward
Help pls:
Write the definitions of the following functions:
getRemainingTransactionTime
setCurrentCustomer
getCurrentCustomerNumber
getCurrentCustomerArrivalTime
getCurrentCustomerWaitingTime
getCurrentCustomerTransactionTime
of the class serverType defined in the section Application of Queues: Simulation.
serverType::serverType()
{
status = "free";
transactionTime = 0;
}
bool serverType::isFree() const
{
return (status == "free");
}
void serverType::setBusy()
{
status = "busy";
}
void serverType::setFree()
{
status = "free";
}
void serverType::setTransactionTime(int t)
{
transactionTime = t;
}
void serverType::setTransactionTime()
{
//TODO: uncomment once getTransactionTime is defined
/*
int time;
time = currentCustomer.getTransactionTime();
transactionTime = time;
*/
}
void serverType::decreaseTransactionTime()
{
transactionTime--;
}
arrow_forward
Performance Task: Develop a program that implements abstraction through the the use of abstract class for the problem in performing a bank transaction with the following operations:
Constructor : Bank Account
Transformers : Deposit( ), Withdraw( )
Observers : Account_Balance( ), noDeposit( ), attainMaxDeposit( )
arrow_forward
import components.naturalnumber.NaturalNumber;import components.naturalnumber.NaturalNumber2;import components.simplewriter.SimpleWriter;import components.simplewriter.SimpleWriter1L;
/*** Program with implementation of {@code NaturalNumber} secondary operation* {@code root} implemented as static method.** @author Mati Desissa**/public final class NaturalNumberRoot {
/*** Private constructor so this utility class cannot be instantiated.*/private NaturalNumberRoot() {}
/*** Updates {@code n} to the {@code r}-th root of its incoming value.** @param n* the number whose root to compute* @param r* root* @updates n* @requires r >= 2* @ensures n ^ (r) <= #n < (n + 1) ^ (r)*/public static void root(NaturalNumber n, int r) {assert n != null : "Violation of: n is not null";assert r >= 2 : "Violation of: r >= 2";
double lowEnough = 0;double tooHigh = n.toInt();double power = 1.0 / r;double value = Math.pow(tooHigh, power);double guess = (1.0) * tooHigh / 2;
while ((int) guess !=…
arrow_forward
Consider that a system has two entities, Student and Course. The student has the following properties:student name, number, SSN and GPA. Similarly, the course has the following properties: course name,course number, credit hours and a set of students who are currently registering on the course.Implement the above system taking into account the following requirements:1.Write a getStudentpByName method in class course that takes a student name and returnsa list of all students who share the same name.2. Write a getStudentByGPA method in class course that takes a GPA and returns a list ofStudents in that course who have the same GPA.
arrow_forward
Programming Exercise 8 asks you to redefine the class to implement the nodes of a linked list so that the instance variables are private. Therefore, the class linkedListType and its derived classes unorderedLinkedList and orderedLinkedList can no longer directly access the instance variables of the class nodeType. Rewrite the definitions of these classes so that these classes use the member functions of the class nodeType to access the info and link fields of a node. Also write programs to test various operations of the classes unorderedLinkedList and orderedLinkedList.
template <class Type>class nodeType{public:const nodeType<Type>& operator=(const nodeType<Type>&);//Overload the assignment operator.void setInfo(const Type& elem);//Function to set the info of the node.//Postcondition: info = elem;Type getInfo() const;//Function to return the info of the node.//Postcondition: The value of info is returned.void setLink(nodeType<Type>…
arrow_forward
Complete the implementation of the class LinkedSortedList, and write a driver program to fully test it.
(Ch. 12, Programming Problems 1, pg. 392 of Data Abstraction and Problem Solving with C++ (7th Edition) )
Name the program sortedlist.cpp. Make sure the following requirements are met.
Program must compile and run.
Must use the Sorted List ADT SortedListInterface.h
For LinkSortedList pg. 376 has the code for insertSorted. You must complete the implementation.
Image shown below:
Therefore the LinkedSortedList is not based on a LinkedList but uses its own link-based implementation.
Do not use throw on function declarations as it is obsolete.
Driver program should:
create a sorted list
insert 21 random numbers (1-100) using the STL random library
Display the numbers as they are inserted.
Then remove the first number inserted.
Last of all display the sorted list of 20 numbers.
No user input for driver program.
SortedListInterface.h:
//Â Created by Frank M. Carrano and Timothy…
arrow_forward
Accomplish the following for the given class diagram.
Elevator
1. Create the class implementation using C++ upDirection
2. Create one object from class Elevator and store it in the stack memory.
3. Create one object from class Elevator and store it in the heap memory.
4. Test all the functions of the two objects • currentFloor: int • move (numFloors : int): void stop (): void + status (): string
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Related Questions
def classify(classifier, point): """ return the classification probability for the given point using the given classifier :params: classifier: list of floats, representing the weights for a logistic classifier point: list of values, representing features of a data point. will be same length as list of weights return: float, representing probability that point is from class 1. """ # TODO: implement this! # placeholder; say "50-50" for any point return 0.5
arrow_forward
SO B N SO RS N Ny M S R T e Problem You want an instance to delegate attribute access to an internally held instance possibly as an alternative to inheritance or in order to implement a proxy.
arrow_forward
Help Please:
Write the definitions of the following functions:
setWaitingTime
getArrivalTime
getTransactionTime
getCustomerNumber
of the class customerType defined in the section Application of Queues: Simulation
#ifndef H_SIMULATION
#define H_SIMULATION
#include <fstream>
#include <string>
#include "queueAsArray.h"
using namespace std;
//**************** customerType ****************
class customerType
{
public:
customerType(int cN = 0, int arrvTime = 0, int wTime = 0,
int tTime = 0);
//Constructor to initialize the instance variables
//according to the parameters
//If no value is specified in the object declaration,
//the default values are assigned.
//Postcondition: customerNumber = cN;
// arrivalTime = arrvTime;
// waitingTime = wTime;
// transactionTime = tTime
void setCustomerInfo(int customerN = 0, int inTime = 0,…
arrow_forward
OZ PROGRAMMING LANGUAGE
Exercise 1. (Efficient Recurrence Relations Calculation) At slide 54 of Lecture 10, we have seen aconcurrent implementation of classical Fibonacci recurrence. This is:
fun {Fib X}
if X==0 then 0
elseif X==1 then 1
else
thread {Fib X-1} end + {Fib X-2}
end
end
By calling Fib for actual parameter value 6, we get the following execution containing several calls ofthe same actual parameters.For example, F3, that stands for {Fib 3}, is calculated independently three times (although it providesthe same value every time). Write an efficient Oz implementation that is doing a function call for a givenactual parameter only once.Consider a more general recurrence relation, e.g.:F0, F1, ..., Fm-1 are known as initial values.Fn = g(Fn-1, ..., Fn-m), for any n ≥ m.For example, Fibonacci recurrence has m=2, g(x, y) = x+y, F0=F1=1
arrow_forward
c++ or java or in pseudo code with explaining
note: if anything is unclear or seems left out make an assumption and document your assumption
Implement an algorithm for assigning seats within a movie theater tofulfill reservation requests. Assume the movie theater has the seatingarrangement of 10 rows x 20 seats, as illustrated to the below.The purpose is to design and write a seat assignmentprogram to maximize both customer satisfaction and customersafety. For the purpose of public safety, assume that a buffer of three seats inbetween
Input DescriptionYou will be given a file that contains one line of input for eachreservation request. The order of the lines in the file reflects the order inwhich the reservation requests were received. Each line in the file will becomprised of a reservation identifier, followed by a space, and then thenumber of seats requested. The reservation identifier will have theformat: R####. See the Example Input File Rows section for anexample of the input…
arrow_forward
java Singly linked list
need help with numbers 5 only 1 to 5 is done but they connected 5 is in the picture
1. Create a class called Citizen with the following attributes/variables:a. String citizenIDb. String citizenNamec. String citizenSurnamed. String citizenCellNumbere. int registrationDayf. int registrationMonthg. int registrationYear2. Create a class called Node with the following attributes/variables:a. Citizen citizen b. Node nextNode 3. Create a class called CitizenRegister with the following attributes/variables:a. Node headNodeb. int totalRegisteredCitizens4. Add and complete the following methods in CitizenRegister:a. head()i. Returns the first citizen object in the linked listb. tail()i. Returns the last citizen object in the linked listc. size()i. Returns the totalRegisteredCitizend. isEmpty()i. Returns the boolean of whether the linked list is empty or note. addCitizenAtHead(Node newNode)i. Adds a new node object containing the citizen object information before the…
arrow_forward
Please use java
Part 2. Library Class
Implement a class, Library, as described in the class diagram below.
Library must implement the Comparable interface.
The compareTo() method must compare the branch names and only the branch names. The comparison must be case insensitive.
The equals() method must compare the branch names and only the branch names. The comparison must be case insensitive.
Be sure to test the equals() and compareTo() methods before proceeding.
Library
- state: String
- branch: String
- city: String
- zip: String
- county: String
- int squareFeet: int
- int hoursOpen: int
- int weeksOpen: int
+ Library(state: String, branch: String, city: String, zip: String, county: String, squareFeet: int, hoursOpen: int, weeksOpen: int)
+ getState(): String
+ getBranch(): String
+ getCity(): String
+ getZip(): String
+ getCounty(): String
+ getSquareFeet(): int
+ getHoursOpen(): int
+ getWeeksOpen(): int
+ setState(state: String): void
+ setBranch(branch:…
arrow_forward
C++
implement a class car.car shall have the following membersa member variable model_year of type int.a member variable model_name of type std :: stringa parameterized constructor that takes both member variables as input parametersa function to retrieve model_yeara function for to retrieve model_name
members' visibility must follow the usual convention
overlay the outflow operator (<<) for class car.input follows the format[model_year] [model_name]
output must have format:Model: [model_name], produced: [model_year]
example:input: 2015 PeugeotOutput; Model: Peugeot, produced: 2015
arrow_forward
Draw a class diagram for the parking office class below. Diagram shoukd not be hand drawn.
N.B Parking office class has relations and dependencies with car, customer, parkinglot and parking charge classes.
public class ParkingOffice {String name;String address;String phone;List<Customer> customers;List<Car> cars;List<ParkingLot> lots;List<ParkingCharge> charges;
public ParkingOffice(){customers = new ArrayList<>();cars = new ArrayList<>();lots = new ArrayList<>();charges = new ArrayList<>();}public Customer register() {Customer cust = new Customer(name,address,phone);customers.add(cust);return cust;}public Car register(Customer c,String licence, CarType t) {Car car = new Car(c,licence,t);cars.add(car);return car;}public Customer getCustomer(String name) {for(Customer cust : customers)if(cust.getName().equals(name))return cust;return null;}public double addCharge(ParkingCharge p) {charges.add(p);return p.amount;}public String[]…
arrow_forward
Computer Science
Please refactor the constructors to reduce code duplication using the call this(), with the proper parameter.
Thank you!
LatencyAnalysis(WarpInterface warp) {
this.latencyReport = new Description();
this.program = warp.toProgram();
this.workload = warp.toWorkload();
this.programTable = program.getSchedule();
this.nodeIndex = program.getNodeMapIndex();
}
LatencyAnalysis(Program program) {
this.latencyReport = new Description();
this.program = program;
this.workload = program.toWorkLoad();
this.programTable = program.getSchedule();
this.nodeIndex = program.getNodeMapIndex();
}
arrow_forward
Problem description:1. Below are classes for a project that involves the creation, displaying andevaluation of a polynomial in x. Organize the classes into a project and test theprogram.2. Based on the project, create a project for the same purpose such thatcoefficients of polynomial may be numbers with decimal digits and that theliteral coefficient in each term must be consistent with the other terms (i.e. A term can be added in an existing polynomial only if the literal is the same asthe literal of the existing terms)./*** The following defines a term of an algebraic polynomial that involves only one* literal. 3x^2 is an example of a term where 3 is the coefficient, x is the* literal and 2 is the degree*/public class Term {private int coef; // data member to hold coefficient of a termprivate int degree; // data member to hold the degree of a termprivate char literal; // data member to hold the literal of a term/*** This a constructor that sets coefficient to 0, degree to 0 and…
arrow_forward
Please help answer this Java multiple choice question.
Assume you are a developer working on a class as part of a software package for running artificial neural networks. The network is made of Nodes (objects that implement a Node interface) and Connections (objects that implement a Connection interface). To create a new connection you call the constructor for a concrete class that implements the Connection interface, passing it three parameters: Node origin, Node target, and double weight. The weight is a double that is greater than or equal to 0, and represents how strongly the target node should weigh the input from the origin node. So with a weight of 0.1 the target node will only slightly weight the input from the origin, but with a weight of 725.67 the target node will strongly weight the input. The method throws an IllegalArgumentException. Which of the following are true?
A. All of the above are true.
B. The code:Connection c = new ConvLayerConnection(origin, target,…
arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning