Given some data in a text file, the task is to scramble the text and output in a separate text file. So, we need to write a Python program that reads a text file, scrambles the words in the file and writes the output to a new text file.
Rules to be followed:
In: Computer Science
As computer systems have evolved, there has been a pattern of increasing complexity and sophistication of individual components. Compare and contrast the evolution of the input functions of the computer system and the output functions of the computer system in modern computers.
In: Computer Science
Imagine that you are the Information Security Officer (ISO) of your organization. Develop a plan to conduct a Web application penetration test on your network. Identify and explain all steps necessary to successfully complete the test.
In: Computer Science
● The Faculty & Staff parking permit allows a car to park in YELLOW and GREEN slots. User
can purchase multiple Faculty & Staffparking permit.
● The Student parking permit allows a car to park in GREEN slots. User can purchase multiple
student parking permit.
● The Resident parking permit allows a car to park in ORANGE and GREEN slots. User can add
a premium package to this kind of permit that allows one of user’s friend to share this permit, but
each user can only purchase one Resident parking permit.
● The Visitor parking permit allows a car to park in ORANGE, YELLOW and GREEN slots.
The permit is only valid for one day and user can only purchase one Visitor parking permit.
User can purchase more than one type of ticket at a time, as many Faculty & Staff and student as
they choose.
Your goal is to write a program that sells the permits and using the existing functions in
hw4a.cpp.
//--------------------------------------------------------------------------- // This is the main program that you need to write //--------------------------------------------------------------------------- int main () { // Variable Declarations char Choice = '\0'; // what the user enters int NumPermits = 0; // how many permits they want to buy int TotalPermits = 0; // total number of permit sold so far float Price = 0.0; // the price of one set of permit float TotalPrice = 0.0; // the total price of all permits char ExitChoice = 'N'; //whether or not the user wants to exit // Print your name and ID cout << "Name: \n" <<"ID: \n\n"; // Loop until the user is done // Print the main menu describing the tickets offered // Ask the user type what permit they want to purchase next // If the user selects Faculty&Staff parking permit calculate the price of tickets // If the user selects Student parking permit be sure to note the reference parameters // If the user selects Resident parking permit, ask if they want the premium package // If the user selected visitor parking permit, make sure they decided to order them // Add the permit price to a running total //Add the number of permits to a running total // Ask if they want to continue (Y or N) // When the loop is done // Print out the total number of permits sold, and the amount of all the permits, with a $. return 0; }
In: Computer Science
Given the following array named 'array1':
array1 DWORD 50h, 51h, 52h, 53h
Write instructions to swap the items in array1 (using only MOV and XCHG instruction), so that the array1 become:
53h, 51h, 50h, 52h
( That means the first item in the array is 53h, second item is 51h, third item is 50h, forth item is 52h).
You can use registers to perform the MOV and XCHG operation.
Write the code to perform above mentioned transformation.
In: Computer Science
In C# please and thanks so much,
Create an Employee class with five fields: first name, last name, workID, yearStartedWked, and initSalary. It includes constructor(s) and properties to initialize values for all fields.
Create an interface, SalaryCalculate, class that includes two functions: first,CalcYearWorked() function, it takes one parameter (currentyear) and calculates the number of year the worker has been working. The second function, CalcCurSalary() function that calculates the current year salary.
Create a Worker classes that is derived from Employee and SalaryCalculate class.
Create a Manager class that is derived from Worker class.
Write an application that reads the workers and managers information from files (“worker.txt” and “manager.txt”) and then creates the dynamic arrays of objects. Prompt the user for current year and display the workers’ and managers’ current information in separate groups: first and last name, ID, the year he/she has been working, and current salary.
Please make streamreader read text from file and the new line so that the text files stay original.
TEXT FILES:
worker.txt
Hector
Alcoser
A001231
1999
24000
Anna
Alaniz
A001232
2001
34000
Lydia
Bean
A001233
2002
30000
Jorge
Botello
A001234
2005
40000
Pablo
Gonzalez
A001235
2007
35000
manager.txt
Sam
Reza
M000411
1995
51000
2005
Jose
Perez
M000412
1998
55000
2002
Rachel
Pena
M000413
2000
48000
2010
In: Computer Science
Consider the STAR schema with dimensions Customer, Product, and Time. The fact table has a measure called Purchase_Price. This measure is:
- additive
-non-additive
-semi-additive
In: Computer Science
In Java: Write a program that generates a random number and asks the user to guess the number and keeps track of how many guesses it took
In: Computer Science
Write a complete main method that does the following: Takes any number, but at least two, command line arguments which are words (represented as strings) and will print to the console the number of words of that end with a digit. (Hint: loop through the args array)
If there are not at least two command line arguments, throw an IllegalArgumentException with an appropriate message.
In: Computer Science
For the following MIPS instructions, (1) show its format or type (I-format, R- format, or J- format); (2) translate them into binary using the follow procedure (Note: $s0-$s7 are the 16-23th registers, $t0-$t7 are the 8-15th registers). For example,
addi $s0, $s1, 2 # the op code of addi is 0010002
Format (?):
lw $s1, 4($s1) # the op code of lw is 1000112
Format (?):
bne $s1, $t1, loop # the value of loop here is 00102 and
# the op code of bne is 0001012
Format (?):
jal leaf # the value of leaf here is 0x2000016
# the op code of jal is 0000112
Format (?):
sub $t1, $s6, $0 # the op code of add is 0 and the funct code is 1000102
Format (?):
In: Computer Science
CPS/IOT have software components. Review SWEBOK. Make a table briefly defining each of 15 knowledge areas. Then for each area provide the bracketed breakdown directly from SWEBOK.
In: Computer Science
PROBLEM STATEMENT:
Using the list container from the STL, write a program that will
read the information from a file into a list
and then display the list to the screen. Add your name. Sort the
list by id. Print the list again
CODE:
Use the provided disneyin2.txt file.
Do not hard code the file name; get file name from user.
Use the struct below
struct student
{
char firstnm[20],
lastnm[20];
int id,
grade;
};
You are to create a list of data type student :
std::list<student> l;
The driver is to demonstrate that the above mentioned operations
are performed.
Overload the << and >> operators so you may easily
input and output a student.
disneyin2.txt
Hewey Duck 123 90
Daffy Duck 342 92
Wiley Coyote 432 89
Goofy Dog 654 95
Daisy Duck 145 92
Sylvester PuddyCat 775 86
Tweety Bird 221 87
Mickey Mouse 666 66
list.t
#ifndef LIST_T_
#define LIST_T_
template <class BaseData>
List <BaseData>::List()
{
previous = 0;
currentNode = 0;
head = 0;
numNodes = 0;
currentPos = 0;
}
template <class BaseData>
List <BaseData>::List(List<BaseData> &init)
{
if (this == &init) return;
ListNode *newList, *current, *newNode;
current = init.head;
newList = 0;
head = 0;
while (current)
{
newNode = new ListNode;
newNode->listData = current->listData;
newNode->link = 0;
if (newList)
{
newList->link = newNode;
newList = newList->link;
}
else newList = newNode;
if (current == init.head)
head = newNode;
current = current->link;
}
numNodes = init.numNodes;
currentPos = 0;
previous = 0;
currentNode = 0;
}
template <class BaseData>
void List <BaseData>::insertBefore(const BaseData
&item)
{
ListNode *p;
p = new ListNode;
p->listData = item;
if (numNodes)
{
if (head == currentNode) head = p;
p->link = currentNode;
if (previous) previous ->link = p;
++numNodes;
currentNode = p;
}
else
{
head = p;
p->link = 0;
previous = 0;
++numNodes;
currentNode = p;
}
}
template <class BaseData>
BaseData * List<BaseData>::examine()
{
BaseData *temp;
if (currentNode)
{
temp = new BaseData;
*temp = currentNode->listData;
return (temp);
}
else
return 0;
}
template <class BaseData>
List <BaseData>::~List()
{
destroy();
}
template <class BaseData>
void List<BaseData>::destroy()
{
ListNode *temp;
currentNode = head;
while (currentNode)
{
temp = currentNode;
currentNode = currentNode->link;
delete temp;
}
previous = 0;
currentNode = 0;
head = 0;
numNodes = 0;
currentPos = 0;
}
template <class BaseData>
void List <BaseData>::first()
{
if (numNodes)
{
previous = 0;
currentNode = head;
currentPos = 1;
}
else
currentPos = 0;
}
template <class BaseData>
void List <BaseData>::last()
{
while (currentNode->link)
{
previous = currentNode;
currentNode = currentNode->link;
}
currentPos = numNodes;
}
template <class BaseData>
void List<BaseData>::makeCurrent (int position)
{
if (( position < 1) || (position > numNodes))
cout << "invalid position: "<< endl;
else
{
first();
for (int i = 1; i < position; i++)
{
previous = currentNode;
currentNode = currentNode->link;
}
currentPos = position;
}
}
template <class BaseData>
void List<BaseData>::prev()
{
int tempCurrPos = currentPos;
if (currentPos > 1)
{
ListNode *temp = previous;
first();
if (currentNode == temp)
{
previous = 0;
currentNode = temp;
}
else
{
while (currentNode->link != temp)
currentNode = currentNode->link;
previous = currentNode;
currentNode = temp;
}
currentPos = tempCurrPos -1;
}
else
{
cout << "walking over front of list";
currentPos = 0;
}
}
template <class BaseData>
void List<BaseData>::next()
{
if (currentNode->link)
{
previous = currentNode;
currentNode = currentNode->link;
currentPos++;
}
else
{
cout << "walking over end of list";
currentPos = 0;
}
}
template <class BaseData>
int List<BaseData>::current()
{
return (currentPos);
}
template <class BaseData>
int List<BaseData>::count()
{
return (numNodes);
}
template <class BaseData>
void List<BaseData>::insertAfter(const BaseData
&item)
{
ListNode *p;
p = new ListNode;
p->listData = item;
if (numNodes)
{
p->link = currentNode->link;
currentNode->link = p;
++numNodes;
previous = currentNode;
currentNode = p;
currentPos++;
}
else
{
head = p;
p->link = 0;
previous = 0;
++numNodes;
currentNode = p;
currentPos++;
}
}
template <class BaseData>
void List<BaseData>::remove()
{
ListNode *p, *temp;
p = currentNode;
if (numNodes) //there are nodes
{if (previous) //this is not the first node in the
list
{ //any other node in list but first
previous->link = currentNode->link;
if (currentNode->link != 0)
currentNode = currentNode->link;
else //deleting last node in list
{
currentPos--;
currentNode = previous;
temp = head;
if (temp == currentNode)
previous = 0;
else
{
while (temp->link != currentNode && temp)
temp = temp->link;
previous = temp;
}
}
delete p;
--numNodes;
}
else
{ //delete first node in list
head = head->link;
delete p;
currentNode = head;
--numNodes;
//if first and last node in list
if (!numNodes) currentPos = 0;
}
}
else cout << "empty list" << endl;
}
template <class BaseData>
void List<BaseData>::replace(BaseData &item)
{
if (currentNode)
currentNode->listData = item;
}
template <class BaseData>
List<BaseData>& List<BaseData>:: operator =
(List<BaseData> &init)
{
if (this == &init) return *this;
ListNode *temp, *newList, *current, *newNode;
currentNode = head;
while (currentNode) //delete existing left side list
{
temp = currentNode;
currentNode = currentNode->link;
delete temp;
}
current = init.head;
newList = 0;
while (current) //copy list
{ newNode = new ListNode;
newNode->listData = current->listData;
newNode->link = 0;
if (newList)
{
newList->link = newNode;
newList = newList->link;
}
else newList = newNode;
if (current == init.head)
head = newNode;
current = current->link;
}
numNodes = init.numNodes;
currentPos = 0;
previous = 0;
currentNode = 0;
return *this;
}
#endif
list.h
#ifndef LIST_H_
#define LIST_H_
#include <iostream>
#include <string>
using std::cout;
using std::endl;
using namespace std;
template <class BaseData>
class List
{
protected:
struct ListNode
{
public:
BaseData listData;
ListNode* link;
};
public:
List();
List(List& init);
~List();
void first();
void last();
void makeCurrent(int position);
void prev();
void next();
int current();
int count();
void insertBefore(const BaseData& item);
void insertAfter(const BaseData& item);
void remove();
void replace(BaseData& item);
BaseData* examine();
List<BaseData>& operator = (List<BaseData>&
source);
void destroy();
protected:
ListNode* head, * currentNode, * previous;
int numNodes;
int currentPos;
};
#include "list.t"
#endif
In: Computer Science
write a script named compute.sh that is used to do simple arithmetic for the user. There should be no command line arguments. Instead, all values from the user should be prompted for and read in to the script using the read command. Specifically, you need to ask the user for two integers and an operation string. The operation should be "add", "sub", "mul", "div", or "exp", for addition, subtraction, multiplication, division, and exponentiation, respectively. Your script should take the two numbers, perform the requested operation, and output the result. Here is a sample run:
[user@localhost ~]$ compute.sh
Enter an integer: 5
Enter another integer: 7
Enter an operation (add,sub,mul,div,exp): mul
5 * 7 = 35
[user@localhost ~]$
The script will have to translate the operation string to the correct operation using either a case statement or if/else statements. Note that you do not need to verify that the numbers given are actual numbers, but you DO need to verify that the operation string is one of the five listed operations. If it isn't one of the five, print an appropriate error message and exit.
Be sure to test your script thoroughly. When you're done, TAKE A SCREENSHOT (5) of the output of the script using some example inputs.
TAKE A SCREENSHOT (6 – computer.sh) your script. I can’t grade if your screenshot is not readable. Bigger font please! If you can’t control font size, please submit the file as text format.
In: Computer Science
Complete the following for full credit in this assignment:
Complete the coding requirement for the Class Method Bodies:
Write the constructor: This should initialize all of your class fields and dynamically allocate memory for your array that will hold your stack data. You should use the constant “n” as the size for your fixed-size stack.
Write the push method: This should add the item in the formal parameter to your stack. Caveat: You need to check and make sure you aren’t going out of bounds with your array. If so, you need to ignore requests to add to the stack as it is full. After that, you can simply add the item and update your cursor (“top” field).
Write the toString method: If the stack is empty, simple return empty brackets “[]”. Otherwise, build a string that consists of every item in the stack inside the brackets and separated by commas (e.g. [1,2,3]). You must use a loop to do this, but you will likely have an extra comma at the end. You can use the substring method to remove the ending comma.
Write the isEmpty method: This can be done in one line if you are savvy. Simply return whether the size of your stack is zero or not.
Write the size method: This can also be done in one line depending on how you programmed the rest of the class. Simply return how many items are currently in the stack.
Write the peek method: This should return the value at the top of the stack. If the stack is empty, return -1. Caveat: Make sure you check whether the stack is empty BEFORE you try accessing array elements otherwise you could crash the program.
Write the pop method: This should return the value at the top of the stack and then remove that item from the stack. We can use “lazy evaluation” which means we don’t actually remove the item but only remove access to it. Simply decrement your cursor variable to remove access to it. If the stack is empty, return -1. Caveat: Make sure you check whether the stack is empty BEFORE you try accessing array elements otherwise you could crash the program.
Write a clear method. This should set the stack to the empty state. In other words, it “resets” the stack to how it was when you first created the stack object. You should use “Lazy Evaluation” for efficiency.
public class Lab05{
public static void main(String[] args){
StackInt st = new StackInt();
p(st.isEmpty());
// This should be true
p(st.peek());
// This
should be -1
p(st.size());
// This
should be 0
for(int i = 0; i < 10;
i++)
st.push(i);
// This adds 10
items to the stack
p(st.toString());
// This should be
[0,1,2,3,4,5,6,7,8,9]
p(st.isEmpty());
// This should be false
p(st.peek());
// This
should be 9
p(st.size());
// This
should be 10
p("Popped " + st.pop() + " from
stack..."); // This should be "Popped 9 from
stack..."
p(st.toString());
// This should be
[0,1,2,3,4,5,6,7,8]
st.clear();
// This
should clear the stack...
p(st.isEmpty());
// This should be true
}
public static <E> void p(E s){
System.out.println(s);
}
}
In: Computer Science
convert -4972.67 to IEEE-754 single precision and double
precision both.
Need a lot of explanation. (Atleast 1000 words)
In: Computer Science