In: Computer Science
Do you think ERP solutions are suitable for SIS University, and
if so, how, or if not, why?
In: Computer Science
Write a java code to ask the user for a string, and assuming the user enters a string containing character "a", your java program must convert all "a" to "b" in the string so for example if user types : "AMAZON" , your program must convert it to "BMBZON"
the driver program must ask :
enter a string containing "a" or "A"
--------- (user enters string)
then it should say;
HERE IS YOUR NEW STRING
---------- (string with all a's converted to b.)
important : all a's should be b and even for capital letters (i.e. A to B).
In: Computer Science
6.13 Lab: Patient Class - process an array of Patient objects
This program will create an array of 100 Patient objects and it will read data from an input file (patient.txt) into this array. Then it will display on the screen the following:
Finally, it writes to another file (patientReport.txt) a table as shown below:
Weight Status Report ==================== === ====== ====== ============= Name Age Height Weight Status ==================== === ====== ====== ============= Jane North 25 66 120 Normal Tim South 64 72 251 Obese . . . ==================== === ====== ====== ============= Number of patients: 5
Assume that a name has at most 20 characters (for formatting). Write several small functions (stand-alone functions). Each function should solve a specific part of the problem.
On each line in the input file there are four items: age, height, weight, and name, as shown below:
25 66 120 Jane North 64 72 251 Tim South
Prompt the user to enter the name of the input file. Generate the name of the output file by adding the word "Report" to the input file's name.
Display the output file's name as shown below:
Report saved in: patientReport.txt
If the user enters the incorrect name for the input file, display the following message and terminate the program:
Input file: patients.txt not found!
Here is a sample output:
Showing patients with the "Underweight" status: Tim South Linda East Paul West Victor Smith Tom Baker Showing patients with the "Overweight" status: none Showing patients with the "Obese" status: none Report saved in: patient1Report.txt
Main.cpp:
#include "Patient.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
const int MAX_SIZE = 100;
/* Write your code here:
declare the function you are going to call in this program
*/
int main()
{
Patient patArr[MAX_SIZE];
int size = 0;
string fileName;
cout << "Please enter the input file's name: ";
cin >> fileName;
cout << endl;
/* Write your code here:
function calls
*/
return 0;
}
/* Write your code here:
function definitions
*/
/*
OUTPUT:
*/
Patient.h:
/*
Specification file for the Patient class
*/
#ifndef PATIENT_H
#define PATIENT_H
#include <string>
using std:: string;
class Patient
{
private:
string name;
double height;
int age;
int weight;
public:
// constructors
Patient();
Patient(string name, int age, double height, int weight);
// setters
void setName(string name);
void setHeight(double height);
void setAge(int age);
void setWeight(int weight);
//getters
string getName() const;
double getHeight() const;
int getAge() const;
int getWeight() const;
// other functions: declare display and weightStatus
void display() const;
string weightStatus() const;
};
#endif
Patient.cpp:
/*
Implementation file for the Patient class.
*/
#include "Patient.h"
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
/*******
This is the default constructor; it sets everything to 0 or
"".
*/
Patient::Patient()
{
name = "";
height = 0;
age = 0;
weight = 0;
}
/*******
This is an overloaded constructor.
It sets the variables according to the parameters.
*/
Patient::Patient(string name, int age, double height, int
weight)
{
this->name = name;
this->height = height;
this->age = age;
this->weight = weight;
}
void Patient::setName(string name)
{
this->name = name;
}
void Patient::setHeight(double height)
{
this->height = height;
}
void Patient::setAge(int age)
{
this->age = age;
}
void Patient::setWeight(int weight)
{
this->weight = weight;
}
string Patient::getName() const
{
return this->name;
}
double Patient::getHeight() const
{
return this->height;
}
int Patient::getAge() const
{
return this->age;
}
int Patient::getWeight() const
{
return this->weight;
}
/*******
This function displays the member variables
in a neat format.
*/
void Patient::display() const
{
cout << fixed;
cout << " Name: " << getName() << endl;
cout << " Age: " << getAge() << endl;
cout << " Height: " << setprecision(0) <<
getHeight() << " inches" << endl;
cout << " Weight: " << getWeight() << " pounds"
<< endl;
cout << "Weight Status: " << weightStatus() <<
endl;
}
/*******
This function calculates the BMI using the following formula:
BMI = (weight in pounds * 703) / (height in inches)^2
Then, it returns a string reflecting the weight status according to
the BMI:
<18.5 = underweight
18.5 - 24.9 = normal
25 - 29.9 = overweight
>=30 = obese
*/
string Patient::weightStatus() const
{
double bmi;
string stat = "";
if (height > 0)
{
bmi = (getWeight() * 703) / (getHeight() * getHeight());
if (bmi < 18.5)
{
stat = "Underweight";
}
else if (bmi >= 18.5 && bmi <= 24.9)
{
stat = "Normal";
}
else if (bmi >= 25 && bmi <= 29.9)
{
stat = "Overweight";
}
else
{
stat = "Obese";
}
}
return stat;
}
In: Computer Science
Write the functions needed by the main function that is given.
multiply2nums should accept 2 values and return the product
(answer you get when you multiply).
greeting should accept one value and print an appropriate greeting
using that value. For example, if you sent "Steven" to the greeting
function, it should print "Hello, Steven"
DO NOT CHANGE ANYTHING IN main()
def main():
user = input("Please enter your name ")
greeting(user)
try:
num1 = int(input("Please enter an integer "))
num2 = int(input("please enter another integer "))
result = multiply2nums(num1,num2)
print("The product of your two numbers is ",result)
except:
print("Error found in input")
main()
In: Computer Science
In this assignment, you will implement a Polynomial linked list, the coefficients and exponents of the polynomial are defined as a node. The following 2 classes should be defined.
p1=23x 9 + 18x 7+3 1. Class Node ● Private member variables: coefficient (double), exponents (integer), and next pointer. ● Setter and getter functions to set and get all member variables ● constructor 2. Class PolynomialLinkedList ● Private member variable to represent linked list (head) ● Constructor ● Public Function to create a Node ● Public function to insert the Node to the linked list (sorted polynomial according to the exponent). ● Public function to print the polynomial in the elegant format: 23x 9 + 18x 7+3 ● Overloaded public function to allow adding two polynomials poly3=poly1+poly2 (23x 9 + 9x 7+3)+(2x 4+3x 7+8x 2 -6) =23x 9 +12 x 7+2x 4+8x 2 -3 ● Overloaded public function to allow negating (!) the sign of any polynomial poly3=!poly1 2x 4+3x 7+8x 2 -6 =- 2x 4 -3x 7+8x 2+6 ● Overloaded public function to allow multiplying two polynomials ● Public function to evaluate polynomial based on an input If x=1, then the value of this polynomial 2x 4+3x 7+8x 2 -6 should be 2(1) 4+3(1) 7+8(1) 2 -6 =7
Main menu to test the following tasks ○ cout << "1. Create polynomial \n"; ○ cout << "2. Print polynomial \n"; ○ cout << "3. Add two polynomilas \n"; ○ cout << "4. Negate polynomial \n"; ○ cout << "5. Multiply two polynomials \n "; ○ cout << "6. Evaluate polynomial \n "; ○ cout << "7. Exit \n";
In: Computer Science
Consider the following un-normalized relational table on an online retail store orders and payments information:
An online retail store would like to create a database to keep track of its sales activities. Information recorded in the database supposed to include customer number that identifies each customer, customer’s first name, last name, unique order number of orders a customer made, the date when an order was made, unique product number of products included in orders, product description, sequence number listing the sequence when a product is included in each order as well as the quantity for each product made in each order. The retail store would also like to store the payment information such as a credit card number of credit card that was being charge to, payment date and the amount paid. The online retail store allows customer to pay using any one of the credit cards the customers own, as long as the credit card is valid.
A database designer created the following relational schema:
CUSTORDER(custNum, custFName, custLName, orderNum, orderDate, prodNum, prodDesc, itemNum, quantity, cCardNum, paymentDate, amountPaid)
Decompose the relational schema into the smallest number of relational schemas each one in forth normal form (4NF) and to explain or justify that each schema is in 4NF. To justify that the relational schemas obtained from the decomposition are in 4NF you must find all functional and multivalued dependencies valid in each relational schema, you must find the minimal keys, and then apply the definitions to support your justification. Note, that a relational schema is in 4NF when it is in BCNF and it does not have any nontrivial multivalued dependencies. It means, that first, you have to prove that a schema is in BCNF and later show that it has no nontrivial multivalued dependencies. Please keep in mind that the smallest number of 4NF relational schemas is expected
In: Computer Science
Create your own programming application and give a brief description of the system.
In: Computer Science
Write a JavaScript program to read and analyze the assessment results of a unit under Node.js host environment. The assessment results are read from the keyboard. The input consists of a list of student results. Each student's result includes the student's name and his or her mark for that unit. These results must be stored in one or several arrays. The input ends when the user types "end".
Once all assessment results are read in, your program should produce a table that summarises the number of students in each grade (HD, D, C, P and N) as well as the percentage of students in each grade. Finally, display the name and mark of the best student.
After the summary table and the best student are displayed, your program prompts the user to inquire about a student's mark. For example, if the user enters the name "John", your program should display the names and marks of all students whose names contain the string "John" (ignore the case).
Your program should allow the user to keep making queries until the user types "stop".
Test and run the above program using Node.js only. Do not use a web browser to test and run your program.
Hints: you may use multiple console.logs to output the data in table-like manner. However, it would be difficulty to make the data in the table properly aligned. Alternatively, you may place the data in a JavaScript object and output the object using console.table. Eg:
(where var hd, d, c, p = number of students in each grade and hdp, dp, cp, pp = percentage of students in each grade)
var hd = ;
var d = ;
var c = ;
var p = ;
var hdp = ;
var dp = ;
var cp = ;
var pp = ;
var table = {};
table.HD = { number: hd, '%': hdp };
table.D = { number: d, '%': dp };
table.C = { number: c, '%': cp };
table.P = { number: p, '%': pp };
console.table (table);
In: Computer Science
Proof that One Time Pad (OTP) is perfectly secured under Ciphertext only attack (COA). Please explain briefly each step of the proof.
In: Computer Science
Why is it important to understand the “people side” of Enterprise Architecture?
Compare and contrast an organization and an enterprise.
How is the Organization Network Model different from the Parsons/Thompson Model of Organizations?
In: Computer Science
Write a Python function that receives a stack object s, where the items in the stack are only numbers in the set {0,1} and returns the number of 1's in the stack s. The function must satisfy the following restrictions:
For example, if the stack contains 0,0,1,1,0,1,0, the function must return 3 and the stack must still contain 0,0,1,1,0,1,0.
In: Computer Science