Questions
Please describe the use of digital payment in your organization and the role of PCI-DSS in...

Please describe the use of digital payment in your organization and the role of PCI-DSS in protecting such transactions. If your organization/workplace does not implement digital payments, suggest a process or avenue to implement it

In: Computer Science

You will create a program that will follow the queuing theory of the Barbershop Problem. You...

You will create a program that will follow the queuing theory of the Barbershop Problem. You will initially create a flow chart for the assignment to be uploaded to the Queuing Theory Flowchart assignment drop box. In this you will use queues and random number generators to complete this project. You will create three queues

  1. Couch - the area where patron will wait just prior to getting their hair cut;
  2. Line - the area where patron will form a line just before reaching the couch; and
  3. Cashier - the area where patrons will line up to pay just before exiting the barbershop and after finishing their haircut.  

You will create a container for the barbers chairs (list) . The wait times for the barbers will be random. Barber one will be the fastest and barber three will be the slowest. Randomize the wait times accordingly.  

The cashier wait times will also vary randomly.

Barber wait times.

  • 1 second (system time) = 5 minutes
  • Max time 2 hours
  • Min time 20 minutes.

Cashier wait time

  • 1 second (system time) = 1 minute
  • Max time 3 minutes
  • Min time 1 minute.

IN PYTHON AND NOT QUIZ

In: Computer Science

Program in Python Problem Statement Write a program with the following functions:  wordCount. This function...

Program in Python

Problem Statement
Write a program with the following functions:
 wordCount. This function should accept a string as a parameter and return the
number of words contained in the string.
 mostFrequentWord. This function accepts a string as a parameter and returns the
word that occurs the most frequently in the string.
 replaceWord. This function accepts three strings as parameters, let’s call them
string1, string2, and string3. It searches string1 for all occurrences of string2. When it finds an occurrence of string2, it replaces it with string3.
For example, suppose the three parameters have the following values:
string1: string2: string3:
“the cat jumped up to reach the ball” “the”
“that”
With these three, the function would return a string with the value “that cat jumped up to reach that ball”
In the main function, ask the user to enter a sentence, and demonstrate each of the above functions.

Sample Output
Enter a sentence: the cat jumped up to reach the ball There are 8 words in the sentence
The most frequent word in the sentence is: the
Enter oldString, then newString you want to replace, separate them with a space: the that The new sentence after replacement is: that cat jumped up to reach that ball

In: Computer Science

List the players that have either won more than 2 matches or lost more than 2...

  1. List the players that have either won more than 2 matches or lost more than 2 matches. List the player number, name, initials, won, and lost. Insert your snip here.
  1. Which players are captains of a team and have ever served as a committee members? Display the player number, player name, initials, team number, and committee member position. This will require 3 tables. Insert your snip here.
  1. Using a subquery, have any other players been penalized the same amount as player 8? Let MySQL do the work for you. Do not explicitly query for $25. Display the player number, player name, initials, and amount. Insert your snip here.
  1. Who has played more than 2 matches? Display the player number as ‘Number’, concatenate the player name (initials, space, name) as ‘Name’, and the number of matches played as ‘Number of Matches’. Insert your snip here.
  1. Sum the number of match wins and losses by player number. Display the player number as ‘Number’, concatenate the player name (initials, space, name) as ‘Name’, wins as ‘Total Wins’, and losses and ‘Total Losses’. Insert your snip here.

***********************************************************************************************************************************************

***********************************************************************************************************************************************

***********************************************************************************************************************************************

Create database tennis;

USE tennis;

#--Create table players and fill it--------------------------

Create table players
(
playerno   int       not null    primary key,
name       varchar(15)   not null,
initials   varchar(3),
birth_date   date,
gender       char(1),
joined       int   not null,
street       varchar(15)   not null,
houseno       varchar(4),
zip       char(6),
town       varchar(10)   not null,
phoneno       char(10),
leagueno   char(4)
);

Insert into players values
(2,'Everett','R','1988-01-09','M',2000,'Stoney Road','43','3575NH','Stratford','070-237893','2411'),
(6,'Paramenter','R','1984-06-25','M',2002,'Haseltine Lane','80','1234KK','Stratford','070-476547','8467'),
(7,'Wise','GWS','1983-05-11','M',2006,'Edgecombe Way','39','9758VB','Stratford','070-347689',Null),
(8,'Newcastle','B','1982-07-08','F',2005,'Station Road','4','6584RO','Inglewood','070-458458','2983'),
(27,'Collins','DD','1990-05-10','F',2008,'Long Drive','804','8457DK','Eltham','079-234857','2513'),
(28,'Collins','C','1983-06-22','F',2008,'Old Main 28','10','1294QK','Midhurst','071-659599',Null),
(39,'Bishop','D','1986-10-29','M',2005,'Eaton Square','78','9629CD','Stratford','070-393435',Null),
(44,'Baker','E','1983-09-01','M',2010,'Lewis Street','23','4444LJ','Inglewood','070-368753','1124'),
(57,'Brown','M','1981-08-17','M',2007,'Edgecombe Way','16','4377CB','Stratford','070-473458','6409'),
(83,'Hope','PK','1976-11-11','M',2009,'Magdalene Road','16A','1812UP','Stratford','070-353548','1608'),
(94,'Miller','P','1993-05-14','M',2013,'High Street','33A','5746OP','Douglas','070-867564',Null),
(100,'Parmenter','P','1983-02-28','M',2012,'Haseltine Lane','80','1234KK','Stratford','070-494593','6524'),
(104,'Moorman','D','1990-05-10','F',2014,'Stout Street','65','9437AO','Eltham','079-987571','7060'),
(112,'Bailey','IP','1983-10-01','F',2014,'Vixen Road','8','6392LK','Plymouth','010-548745','1319');

#--Create the table committee_members and fill it--------------------

Create table committee_members
(
playerno   int   not null,
begin_date   date   not null,
end_date   date,
position   varchar(20),
primary key(playerno, begin_date)
);

Insert into committee_members values
(2,'2010-01-01','2012-12-31','Chairman'),
(2,'2014-01-01',Null,'General Member'),
(6,'2010-01-01','2010-12-31','Secretary'),
(6,'2011-01-01','2012-12-31','General Member'),
(6,'2012-01-01','2013-12-31','Treasurer'),
(6,'2013-01-01',Null,'Chairman'),
(8,'2010-01-01','2010-12-31','Treasurer'),
(8,'2011-01-01','2011-12-31','Secretary'),
(8,'2013-01-01','2013-12-31','General Member'),
(8,'2014-01-01',Null,'General Member'),
(27,'2010-01-01','2010-12-31','General Member'),
(27,'2011-01-01','2011-12-31','Treasurer'),
(27,'2013-01-01','2013-12-31','Treasurer'),
(57,'2012-01-01','2012-12-31','Secretary'),
(94,'2014-01-01',Null,'Treasurer'),
(112,'2012-01-01','2012-12-31','General Member'),
(112,'2014-01-01',Null,'Secretary');

#--Create the table matches and Fill it-------------------

Create table matches
(
matchno       int   not null   Primary Key,
teamno       int   not null   references teams(teamno),
playerno   int   not null   references players(playerno),
won       int,
lost       int
);


Insert into matches values
(1,1,6,3,1),
(2,1,6,2,3),
(3,1,6,3,0),
(4,1,44,3,2),
(5,1,83,0,3),
(6,1,2,1,3),
(7,1,57,3,0),
(8,1,8,0,3),
(9,2,27,3,2),
(10,2,104,3,2),
(11,2,112,2,3),
(12,2,112,1,3),
(13,2,8,0,3);

#--Create Table Penalties and Fill it-------------------------------------

create table Penalties
(
paymentno   int   not null   Primary Key,
playerno   int   not null   references players(playerno),
payment_Date   date   not null,
amount   decimal(10,2)   not null
);


Insert into Penalties values
(1,6,'2010-12-08',100.00),
(2,44,'2011-05-05',75.00),
(3,27,'2013-09-10',100.00),
(4,104,'2014-07-08',50.00),
(5,44,'2010-12-08',25.00),
(6,8,'2010-12-08' ,25.00),
(7,44,'2012-12-30',30.00),
(8,27,'2014-08-12',75.00);

#--Create Table Teams and Fill it----------------------------------------------

Create table teams
(
teamno   int   Primary Key   Not Null,
playerno   int   Not Null   references players(playerno),
division   varchar(6)
);


Insert into teams values
(1,6,'first'),
(2,27,'second');

/* ********************************************************************************************
End of loading the database
******************************************************************************************** */

In: Computer Science

JAVA Write a test program that prompts the user to enter a list and displays whether...

JAVA

Write a test program that prompts the user to enter a list and displays whether the list is sorted or not. Here is a sample run. Note that the program first prompts the user to enter the size of the list. Using Array

My output should look like this

Enter the size of the list: 8

Enter the contents of the list: 10 1 5 16 61 9 11 1

The list has 8 integers 10 1 5 16 61 9 11 1

The list is not sorted

In: Computer Science

When an interrupt occurs while operating in User mode, present the rWhen an interrupt occurs while...

When an interrupt occurs while operating in User mode, present the rWhen an interrupt occurs while operating in User mode,

present the return instruction of the exception handler and describe the reason for such a 3 stage pipeline structure

In: Computer Science

In Python, Complete the longestWord() function to take a list as a parameter and return the...

In Python,

Complete the longestWord() function to take a list as a parameter and return the length of the longest word in that list.

Examples:

longestWord(['Python', 'rocks']) returns 5

longestWord(['Casey', 'Riley', 'Jessie', 'Jackie', 'Jaime', 'Kerry', 'Jody']) returns 6

longestWord(['I', 'a', 'am', 'an', 'as', 'at', 'ax', 'the']) returns 3

In: Computer Science

Using Python provide the implementation of a function called "isAdjacent" that accepts a string.   The function...

Using Python provide the implementation of a function called "isAdjacent" that accepts a string.   The function checks if two adjacent characters in the string are the same; if they are the same, then return True otherwise return False.   The function should ignore case and check for non-empty string.  If it's an empty string, then return the message 'Empty string'.

Sample runs:

print( isAdjacent('ApPle')) # True
print( isAdjacent('Python')) # False
print( isAdjacent('')) # Empty string

In: Computer Science

Using the Class database: Using a union, display the date and student id those students from...

Using the Class database:

  1. Using a union, display the date and student id those students from the absence table with the date and category of any grade event. Place in order by date. Insert your snip here.
  1. List the scores for student 17 for every List the student id, event id, score, and category for student id 17. Insert your snip here.
  1. For every student in the student table, display the student id as ‘ID’, student name as ‘Name’, and the total number of tests and quizzes each student has taken as ‘Number Taken’. Insert your snip here.
  1. Who missed a test or quiz? Display the student id as ‘ID’, student name as ‘Name’, the category of the test or quizzed missed as ‘Category’, and the date as ‘Date’. You will use 3 tables here. Insert your snip here.
  1. Display the average score for each test event. Do not explicitly test for individual event ids. Let MySQL do the work for you. Display the event id as ‘Event’ and the average score for that event as ‘Average Score’. Insert your snip here.

***********************************************************************************************************************************************

***********************************************************************************************************************************************

***********************************************************************************************************************************************
#---Create and open the database

drop database if exists Class;

CREATE DATABASE Class;


#-- Using the database

USE Class;

# create student table


DROP TABLE IF EXISTS student;

CREATE TABLE student

(
  
name VARCHAR(20) NOT NULL,
  
gender ENUM('F','M') NOT NULL,
  
student_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  
PRIMARY KEY (student_id)

);

# create grade event table

DROP TABLE IF EXISTS grade_event;

CREATE TABLE grade_event

(
  
date DATE NOT NULL,
  
category ENUM('T','Q') NOT NULL,
  
event_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  
PRIMARY KEY (event_id)

);

# create score table


# The PRIMARY KEY comprises two columns to prevent any combination
# of event_id/student_id from appearing more than once.


DROP TABLE IF EXISTS score;


CREATE TABLE score

(
  
student_id INT UNSIGNED NOT NULL,
  
event_id INT UNSIGNED NOT NULL,
  
score INT NOT NULL,
  
PRIMARY KEY (event_id, student_id),
  
INDEX (student_id),
  
FOREIGN KEY (event_id) REFERENCES grade_event (event_id),
  
FOREIGN KEY (student_id) REFERENCES student (student_id)

);

# create absence table


DROP TABLE IF EXISTS absence;

CREATE TABLE absence

(
  
student_id INT UNSIGNED NOT NULL,
  
date DATE NOT NULL,
  
PRIMARY KEY (student_id, date),
  
FOREIGN KEY (student_id) REFERENCES student (student_id)

);

#--Populate the student table


INSERT INTO student VALUES ('Megan','F',NULL);

INSERT INTO student VALUES ('Joseph','M',NULL);

INSERT INTO student VALUES ('Kyle','M',NULL);

INSERT INTO student VALUES ('Katie','F',NULL);

INSERT INTO student VALUES ('Abby','F',NULL);

INSERT INTO student VALUES ('Nathan','M',NULL);

INSERT INTO student VALUES ('Liesl','F',NULL);

INSERT INTO student VALUES ('Ian','M',NULL);

INSERT INTO student VALUES ('Colin','M',NULL);

INSERT INTO student VALUES ('Peter','M',NULL);

INSERT INTO student VALUES ('Michael','M',NULL);

INSERT INTO student VALUES ('Thomas','M',NULL);

INSERT INTO student VALUES ('Devri','F',NULL);

INSERT INTO student VALUES ('Ben','M',NULL);

INSERT INTO student VALUES ('Aubrey','F',NULL);

INSERT INTO student VALUES ('Rebecca','F',NULL);

INSERT INTO student VALUES ('Will','M',NULL);

INSERT INTO student VALUES ('Max','M',NULL);

INSERT INTO student VALUES ('Rianne','F',NULL);

INSERT INTO student VALUES ('Avery','F',NULL);

INSERT INTO student VALUES ('Lauren','F',NULL);

INSERT INTO student VALUES ('Becca','F',NULL);

INSERT INTO student VALUES ('Gregory','M',NULL);

INSERT INTO student VALUES ('Sarah','F',NULL);

INSERT INTO student VALUES ('Robbie','M',NULL);

INSERT INTO student VALUES ('Keaton','M',NULL);

INSERT INTO student VALUES ('Carter','M',NULL);

INSERT INTO student VALUES ('Teddy','M',NULL);

INSERT INTO student VALUES ('Gabrielle','F',NULL);

INSERT INTO student VALUES ('Grace','F',NULL);

INSERT INTO student VALUES ('Emily','F',NULL);


#--Populate grade event table

INSERT INTO grade_event VALUES('2015-09-03', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-09-06', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-09-09', 'T', NULL);
INSERT INTO grade_event VALUES('
2015-09-16', 'Q', NULL);
INSERT INTO grade_event VALUES(
'2015-09-23', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-10-01', 'T', NULL);


#--Populate the score table


INSERT INTO score VALUES (1,1,20);

INSERT INTO score VALUES (3,1,20);

INSERT INTO score VALUES (4,1,18);

INSERT INTO score VALUES (5,1,13);

INSERT INTO score VALUES (6,1,18);

INSERT INTO score VALUES (7,1,14);

INSERT INTO score VALUES (8,1,14);

INSERT INTO score VALUES (9,1,11);

INSERT INTO score VALUES (10,1,19);

INSERT INTO score VALUES (11,1,18);

INSERT INTO score VALUES (12,1,19);

INSERT INTO score VALUES (14,1,11);

INSERT INTO score VALUES (15,1,20);

INSERT INTO score VALUES (16,1,18);

INSERT INTO score VALUES (17,1,9);

INSERT INTO score VALUES (18,1,20);

INSERT INTO score VALUES (19,1,9);

INSERT INTO score VALUES (20,1,9);

INSERT INTO score VALUES (21,1,13);

INSERT INTO score VALUES (22,1,13);

INSERT INTO score VALUES (23,1,16);

INSERT INTO score VALUES (24,1,11);

INSERT INTO score VALUES (25,1,19);

INSERT INTO score VALUES (26,1,10);

INSERT INTO score VALUES (27,1,15);

INSERT INTO score VALUES (28,1,15);

INSERT INTO score VALUES (29,1,19);

INSERT INTO score VALUES (30,1,17);

INSERT INTO score VALUES (31,1,11);

INSERT INTO score VALUES (1,2,17);

INSERT INTO score VALUES (2,2,8);

INSERT INTO score VALUES (3,2,13);

INSERT INTO score VALUES (4,2,13);

INSERT INTO score VALUES (5,2,17);

INSERT INTO score VALUES (6,2,13);

INSERT INTO score VALUES (7,2,17);

INSERT INTO score VALUES (8,2,8);

INSERT INTO score VALUES (9,2,19);

INSERT INTO score VALUES (10,2,18);

INSERT INTO score VALUES (11,2,15);

INSERT INTO score VALUES (12,2,19);

INSERT INTO score VALUES (13,2,18);

INSERT INTO score VALUES (14,2,18);

INSERT INTO score VALUES (15,2,16);

INSERT INTO score VALUES (16,2,9);

INSERT INTO score VALUES (17,2,13);

INSERT INTO score VALUES (18,2,9);

INSERT INTO score VALUES (19,2,11);

INSERT INTO score VALUES (21,2,12);

INSERT INTO score VALUES (22,2,10);

INSERT INTO score VALUES (23,2,17);
INSERT INTO score VALUES (24,2,19);

INSERT INTO score VALUES (25,2,10);

INSERT INTO score VALUES (26,2,18);

INSERT INTO score VALUES (27,2,8);

INSERT INTO score VALUES (28,2,13);

INSERT INTO score VALUES (29,2,16);

INSERT INTO score VALUES (30,2,12);

INSERT INTO score VALUES (31,2,19);

INSERT INTO score VALUES (1,3,88);

INSERT INTO score VALUES (2,3,84);

INSERT INTO score VALUES (3,3,69);

INSERT INTO score VALUES (4,3,71);

INSERT INTO score VALUES (5,3,97);

INSERT INTO score VALUES (6,3,83);

INSERT INTO score VALUES (7,3,88);
INSERT INTO score VALUES (8,3,75);

INSERT INTO score VALUES (9,3,83);

INSERT INTO score VALUES (10,3,72);
INSERT INTO score VALUES (11,3,74);

INSERT INTO score VALUES (12,3,77);

INSERT INTO score VALUES (13,3,67);
INSERT INTO score VALUES (14,3,68);

INSERT INTO score VALUES (15,3,75);

INSERT INTO score VALUES (16,3,60);

INSERT INTO score VALUES (17,3,79);

INSERT INTO score VALUES (18,3,96);

INSERT INTO score VALUES (19,3,79);

INSERT INTO score VALUES (20,3,76);

INSERT INTO score VALUES (21,3,91);

INSERT INTO score VALUES (22,3,81);

INSERT INTO score VALUES (23,3,81);

INSERT INTO score VALUES (24,3,62);

INSERT INTO score VALUES (25,3,79);

INSERT INTO score VALUES (26,3,86);

INSERT INTO score VALUES (27,3,90);

INSERT INTO score VALUES (28,3,68);

INSERT INTO score VALUES (29,3,66);

INSERT INTO score VALUES (30,3,79);

INSERT INTO score VALUES (31,3,81);

INSERT INTO score VALUES (2,4,7);

INSERT INTO score VALUES (3,4,17);

INSERT INTO score VALUES (4,4,16);

INSERT INTO score VALUES (5,4,20);

INSERT INTO score VALUES (6,4,9);

INSERT INTO score VALUES (7,4,19);

INSERT INTO score VALUES (8,4,12);

INSERT INTO score VALUES (9,4,17);

INSERT INTO score VALUES (10,4,12);

INSERT INTO score VALUES (11,4,16);

INSERT INTO score VALUES (12,4,13);

INSERT INTO score VALUES (13,4,8);

INSERT INTO score VALUES (14,4,11);

INSERT INTO score VALUES (15,4,9);

INSERT INTO score VALUES (16,4,20);

INSERT INTO score VALUES (18,4,11);

INSERT INTO score VALUES (19,4,15);

INSERT INTO score VALUES (20,4,17);

INSERT INTO score VALUES (21,4,13);

INSERT INTO score VALUES (22,4,20);

INSERT INTO score VALUES (23,4,13);

INSERT INTO score VALUES (24,4,12);
INSERT INTO score VALUES (25,4,10);

INSERT INTO score VALUES (26,4,15);

INSERT INTO score VALUES (28,4,17);

INSERT INTO score VALUES (30,4,11);

INSERT INTO score VALUES (31,4,19);

INSERT INTO score VALUES (1,5,15);

INSERT INTO score VALUES (2,5,12);

INSERT INTO score VALUES (3,5,11);

INSERT INTO score VALUES (5,5,13);

INSERT INTO score VALUES (6,5,18);

INSERT INTO score VALUES (7,5,14);

INSERT INTO score VALUES (8,5,18);

INSERT INTO score VALUES (9,5,13);

INSERT INTO score VALUES (10,5,14);

INSERT INTO score VALUES (11,5,18);

INSERT INTO score VALUES (12,5,8);

INSERT INTO score VALUES (13,5,8);

INSERT INTO score VALUES (14,5,16);

INSERT INTO score VALUES (15,5,13);

INSERT INTO score VALUES (16,5,15);

INSERT INTO score VALUES (17,5,11);

INSERT INTO score VALUES (18,5,18);

INSERT INTO score VALUES (19,5,18);
INSERT INTO score VALUES (20,5,14);

INSERT INTO score VALUES (21,5,17);

INSERT INTO score VALUES (22,5,17);

INSERT INTO score VALUES (23,5,15);

INSERT INTO score VALUES (25,5,14);

INSERT INTO score VALUES (26,5,8);

INSERT INTO score VALUES (28,5,20);

INSERT INTO score VALUES (29,5,16);

INSERT INTO score VALUES (31,5,9);

INSERT INTO score VALUES (1,6,100);

INSERT INTO score VALUES (2,6,91);

INSERT INTO score VALUES (3,6,94);

INSERT INTO score VALUES (4,6,74);

INSERT INTO score VALUES (5,6,97);

INSERT INTO score VALUES (6,6,89);

INSERT INTO score VALUES (7,6,76);

INSERT INTO score VALUES (8,6,65);

INSERT INTO score VALUES (9,6,73);

INSERT INTO score VALUES (10,6,63);

INSERT INTO score VALUES (11,6,98);

INSERT INTO score VALUES (12,6,75);

INSERT INTO score VALUES (14,6,77);

INSERT INTO score VALUES (15,6,62);

INSERT INTO score VALUES (16,6,98);

INSERT INTO score VALUES (17,6,94);

INSERT INTO score VALUES (18,6,94);

INSERT INTO score VALUES (19,6,74);
INSERT INTO score VALUES (20,6,62);

INSERT INTO score VALUES (21,6,73);

INSERT INTO score VALUES (22,6,95);

INSERT INTO score VALUES (24,6,68);

INSERT INTO score VALUES (25,6,85);

INSERT INTO score VALUES (26,6,91);
INSERT INTO score VALUES (27,6,70);

INSERT INTO score VALUES (28,6,77);

INSERT INTO score VALUES (29,6,66);

INSERT INTO score VALUES (30,6,68);

INSERT INTO score VALUES (31,6,76);


#--Populate the absence table

INSERT INTO `absence` VALUES (3,'2015-09-03');

INSERT INTO `absence` VALUES (5,'2015-09-03');

INSERT INTO `absence` VALUES (10,'2015-09-06');

INSERT INTO `absence` VALUES (10,'2015-09-09');

INSERT INTO `absence` VALUES (17,'2015-09-07');

INSERT INTO `absence` VALUES (20,'2015-09-07');

In: Computer Science

SOLVE IN C: 6.31 LAB: Print string in reverse Write a program that takes in a...

SOLVE IN C: 6.31 LAB: Print string in reverse

Write a program that takes in a line of text as input, and outputs that line of text in reverse. You may assume that each line of text will not exceed 50 characters.The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text.

Ex: If the input is:

Hello there
Hey
quit

then the output is:

ereht olleH
yeH

Hint: Use the fgets function to read a string with spaces from the user input. Recall that if a newline character is read from the user input before the specified number of characters are read, the newline character itself is also written into the string.

In: Computer Science

C++ Assignment. Design the Weather class that contains the following members: Data members to store: -...

C++ Assignment.

Design the Weather class that contains the following members:

Data members to store:

- a day (an integer)

- a month (an integer)

- a year (an integer)

- a temperature (a float)

- a static data member that stores the total of all temperatures (a float)

Member functions:

- a constructor function that obtains a day, month, year and temperature from the user. This function should also accumulate/calculate the total of all temperatures (i.e., add the newly entered temperature to the total).

- a static function that computes and displays the day which has the lowest temperature. Note: An array of Weather objects and the size of the array will be passed to this function.

- a static function that computes and displays the average temperature. This function should use a parameter, if necessary.

Design the main( ) function, which instantiates/creates any number of objects of the Weather class as requested by the user (i.e., creates a dynamic array of Weather objects). main( ) should also call appropriate functions to compute and display the day that has the lowest temperature, as well as the average temperature. Your program should include all necessary error checking.

A sample run of this program could be as follows:

How many days => 4

Enter day, month, year, temperature => 29 11 2018 15.6

Enter day, month, year, temperature => 30 11 2018 8.7

Enter day, month, year, temperature => 1 12 2018 3.1

Enter day, month, year, temperature => 2 12 2018 3.5

Lowest temperature = 3.1 C, Day 1/12/2018

Average temperature = 7.7 C

In: Computer Science

Limit your answers to one paragraph or less. 1. Explain the difference between a statically allocated...

Limit your answers to one paragraph or less.

1. Explain the difference between a statically allocated array, a dynamically allocated array, and a linked list.

2. Linked lists have terrible performance for random access or searching of internal entries. Why?

3. Explain the advantages of adding a tail pointer to a linked list, and of doubly-linked over singlylinked lists.

In: Computer Science

Can I use a linear gain function in any of its layers of a multilayer perceptron?...

Can I use a linear gain function in any of its layers of a multilayer perceptron? Explain

In: Computer Science

Q: IN C++ -  Redesign the CaesarCipher class as a subclass of the SubstitutionCipher from the previous...

Q: IN C++ -  Redesign the CaesarCipher class as a subclass of the SubstitutionCipher from the previous problem

my code is:

#include <iostream>
#include <string>

using namespace std;

class SubstitutionCipher {
public:
//Define your key which is a permutation of 26 alphabets
string key;

//Constructor to create an instance which initializes the key with the given permutation
SubstitutionCipher(string k) {
key = k;
}

//function to encode a string
string encode(string data) {
//initialize encoded data
string encodedData = data;
//replace each character in encodedData with the corresponding mapped data in key. We subtract a char with 'A' to get its position
for (int i = 0; i < data.length(); i++) {
encodedData[i] = key.at(data.at(i) - 'A');
}
//return the encoded data
return encodedData;
}

//function to decode a string
string decode(string data) {
//initialize decoded data
string decodedData = data;
//replace each character in decodedData with the corresponding reverse mapped data in key. We add the position with 'A' to get the corresponding char
for (int i = 0; i < data.length(); i++) {
decodedData[i] = key.find(data.at(i)) + 'A';
}
//return the decoded data
return decodedData;
}

};

//main() method to test the implementation
int main() {
SubstitutionCipher cipher("ZYXWVUTSRQPONMLKJIHGFEDCBA");
string data = "DEBAJYOTI";
string encodedData = cipher.encode(data);
cout << data << " encoded as " << encodedData << endl;
string decodedData = cipher.decode(encodedData);
cout << encodedData << " decoded as " << decodedData;
}

In: Computer Science

Q:You have to write a function that contains three varibles as the following Diamond Gold Silver...

Q:You have to write a function that contains three varibles as the following

Diamond
Gold
Silver

Each varible has a one third (1/3) chance of appearing with a random quantity between (1 & 2)

as a visual basic / C++

In: Computer Science