End user computing------in some cases an organization’s information system (IS) is planned and centered on specific goals; in other cases, technology is an afterthought to the actual business objectives. Can you think of examples of how technology has altered the way we do business today? Were those changes and implementations accomplished by understanding the goals of the business?
In: Computer Science
Language: C++
The program I have written below needs to allow the user to enter in their own date, however I currently can only get it to output a default date, 10/10/2018. After the user enters the date it needs to go through the exception checks to make sure it is a valid date. Afterword the user needs to be prompted to change their date.
Here is the code:
#include <iostream>
#include <cmath>
#include <fstream>
#include <cstring>
#include <sstream>
#include <vector>
using namespace std;
class Date
{
private:
int month, day, year;
int days[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
string month_name[13] = { "","January","February","March","April","May","June","July","August","September","October","November","December" };
public:
Date(int m, int d, int y)
{
if (m < 1 || m>12)
{
throw "Invalid month";
}
if (d<1 || d>days[m])
{
throw "Invalid date";
}
if (y < 1950 || y>2020)
{
throw "Invalid year";
}
month = m;
day = d;
year = y;
}
void setMonth(int m)
{
if (m < 1 || m>12)
{
throw "Invalid month";
}
month = m;
}
void setYear(int y)
{
if (y < 1950 || y>2020)
{
throw "Invalid year";
}
year = y;
}
void setDate(int d)
{
if (d<1 || d>days[d])
{
throw "Invalid date";
}
day = d;
}
void toString()
{
cout << month_name[month] << " " << day << ", " << year << endl;
}
};
int main()
{
cout << "Please enter in the date in format mm,
dd, yyyy." << endl;
Date d(10, 10, 2018);
d.toString();
try
{
d.setDate(44);
}
catch (const char* msg)
{
cerr << msg << endl;
}
return 0;
}
In: Computer Science
*****************PLEASE PROVIDE THE CODE IN RACKET PROGRAMMING LANGUAGE ONLY AND MAKE SURE CODE RUNS ON THE WESCHEME IDE*************
Write a tail-recursive Racket function "kept-short-rec" that takes an integer and a list of strings as parameters and evaluates to an integer. The resulting integer should be the number of strings on the original list whose string length is less than the integer parameter. For example, (kept-short-rec 3 '("abc" "ab" "a")) should evaluate to 2 because there are only 2 strings shorter than 3.
Your solution must be tail-recursive. Recall that a function is tail-recursive if it is recursive and every recursive call has no work to be done after the call completes. Note: (string-length s) evaluates to the length of string s.
(define (kept-short-rec-helper acc n xs)
(if (empty? xs)
???
(if (< (string-length (first xs)) n)
???
???))
(define (kept-short-rec n xs)
(kept-short-rec-helper ??? n xs))
In: Computer Science
*****************PLEASE GIVE THE CODE IN RACKET PROGRAMMING ONLY AND MAKE SURE THE CODE RUNS ON WESCHEME IDE***************
Write a recursive Racket function "keep-short-rec" that takes an integer and a list of strings as parameters and evaluates to a list of strings. The resulting list should be all of the strings from the original list, maintaining their relative order, whose string length is less than the integer parameter. For example, (keep-short-rec 3 '("abc" "ab" "a")) should evaluate to '("ab" "a") because these are the only strings shorter than 3. Your solution must be recursive. Note: (string-length s) evaluates to the length of string s
In: Computer Science
C++ Given Stack Code, Implements Queue. enqueue, dequeue. Modify to function like Queue. Stack #ifndef STACK_H #define STACK_H #include "Node.h" template class Stack { private: Node* top; public: // Constructor Stack() { top = nullptr; } void push(Object ab) { if (top != nullptr) { Node* newNode = new Node(ab, *top); top = newNode; } else { Node* newNode = new Node(ab); top = newNode; } } Object pop() { if (top != nullptr) { Node *returnVal = top; top = top->getNext(); Object returnObject = returnVal->getItem(); delete returnVal; return returnObject; } else { return Object(); } } bool isThere(Object a) { Node* Copy = top; while (Copy != nullptr) { if (Copy->getItem() == a) { return true; } Copy = Copy->getNext(); } return false; } }; #endif //STACK_H
View comments (1)
In: Computer Science
Consider the ternary number system. What is the corresponding regular expression of a DFA that accepts ternary strings that are not divisible by nine?
In: Computer Science
Give your opinion on server-side vs. client-side validation. Which is better in your opinion? Who should have the power in this validation process
In: Computer Science
Write a java program. The program requirements are: the program will let the user input a starting number, such as 2. It will generate ten multiplication problems ranging from 2x1 to 2x10. For each problem, the user will be prompted to enter the correct answer. The program should check the answer and should not let the user advance to the next question until the correct answer is given to the question being asked currently.
After testing a total of 10 multiplication problems, your program should ask whether the user would like to try another starting number. If the user answers "yes", your program should generate another corresponding ten multiplication problems. This procedure should repeat until the user indicated "no".
In: Computer Science
Write a C++ code for these 2 questions
1. Create an integer variable named ‘arraySize’ and initialize the value to 1000.
2.. Open an output file named ‘GroupAssignment2Results.csv’. The first line of this file should be the column headings: ‘Array Size’, ‘Bubble Sort Time’, ‘Selection Sort Time’, ’Insertion Sort Time’, ‘Quick Sort Time’, ‘Merge Sort Time’.
In: Computer Science
*****************PLEASE GIVE THE CODE IN RACKET PROGRAMMING ONLY AND MAKE SURE THE CODE RUNS ON WESCHEME IDE***************
Write a recursive Racket function "sum-diff" that takes two lists of integers that are the same length and evaluates to an integer. The resulting integer should be the sum of the absolute value of the differences between each pair of integers with the same index in the two lists. For example (sum-diff '(-1 -2 -3) '(1 2 3)) should evaluate to 12 because the absolute value of the differences between (-1 and 1), (-2 and 2) and (-3 and 3) are 2, 4, and 6, and 2+4+6=12. Note: (abs n) evaluates to the absolute value of n. Also, if the lists are empty the sum should be 0
In: Computer Science
Write a C program that demonstrate tree traversal.
A. first is to ask the user to enter data
B. ask how many nodes
THIS IS JUST A SAMPLE. PLEASE ANSWER IT IN COMPLETE CODE.
See for the sample output.
Sample Output:
How many node do you have in your tree : 5
Enter root: 20
if you want to add to the left press 0 otherwise press 1
answer: 0
Enter next node: 10
if you want to add to the left press 0 otherwise press 1
answer: 0
Enter next node: 8
if you want to add to the left press 0 otherwise press 1
answer: 0
Enter next node: 15
if you want to add to the left press 0 otherwise press 1
answer: 1
Enter next node: 21
Display tree
20
/ \
10 21
/
8
/
5
Preorder – 20, 10, 8, 5, 21
Inorder – 5, 8, 10, 20, 21
Postorder – 5, 8, 10, 21, 20
COMMENT CODE PLS....
In: Computer Science
g[8]=4[A[3j] + B[i+6j]
I and j are variables. When doing MIPS instructions for above statement what needs to be done to 4[A[3j]? Choose your own temporary and store registers. Explain show step by step
In: Computer Science
In: Computer Science
Give an algorithm for reversing a queue Q. Only following standard operations are allowed on queue. 1. enqueue(x) : Add an item x to rear of queue. 2. dequeue() : Remove an item from front of queue. 3. empty() : Checks if a queue is empty or not.. (Hint: you can use LinkedList, Stacks, and Queues from the java data collection)
OUTPUT Examples: Input : Q = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] Output :Q = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10] Input :[1, 2, 3, 4, 5] Output :[5, 4, 3, 2, 1]
In: Computer Science
(Machine learning Neural Network) Consider a regression Multilayer Perceptron (MLP) that uses identity activation functions for all neurons. A data scientist trains the neural network to minimize the MSE(Mean Squared Error), and he observes a much smaller training set MSE for the MLP as compared to that for OLS (Oridinary Least Squares). Is this possible? Justify your answer.
In: Computer Science