Write a C++ program that will be an information system for Oregon State University using classes as well as demonstrating a basic understanding of inheritance and polymorphism.
You will create a representation of an Oregon State University information system that will contain information about the university. The university will contain a name of the university, n number of buildings, and m number of people. People can be either a student or an instructor. Every person will have a name and an age. Every student will have also have a GPA, but an instructor will NOT have a GPA. Every instructor will have an instructor rating, but a student will NOT have an instructor rating. Every building will have a name, the size in sqft (preferred the real value which you need to look up), and an address (stored as a string, also preferred to look this up).
People will contain a method called “do_work” that will take in a random integer as a parameter that represents how many hours they will do work for. If the person is a student, a message will be printed to the screen that says “PERSON_NAME did X hours of homework.” If the person is an instructor, a message will be printed to the screen that says “Instructor PERSON_NAME graded papers for X hours.” You will need to fill in the appropriate values.
The student GPA can either be an input from the user or randomized, but it must be between 0.0 and 4.0. It cannot be preset. The instructor rating can either be an input from the user or randomized, but it must be between 0.0 and 5.0. The ages of a person can be randomized or an input, but make it realistic. You can choose whether it is randomized or user input, or both.
The university will contain a method that will print the name and address of all the buildings in its information system and another method that will print the name of all the people. The name of the university MUST be “Oregon State University” (because we are the best).
You will manually instantiate at least 1 student, 1 instructor, and 2 buildings, then give them values and store them appropriately in the university object. You can do this in whatever fashion you wish.
You will have a menu that does at least the following:
1) Prints names of all the buildings
2) Prints names of everybody at the university
3) Choose a person to do work
4) Exit the program
Note that option 3 will require you to print another menu that gives options for each person.
You may create any other functions, methods, member variables, etc. to modularize your code and complete the lab.
Extra Credit Add an option to save the information system to a file, and add an option to read a saved information system from a file so that you can close the program, but not lose information. This will also require you to be able to add people and/or buildings to the program during runtime. This is an all or nothing extra credit (you will not get partial points for partial completion).
In: Computer Science
Class GroceryBag
collects instances of class Item in an appropriate
data structure.
Class Item
---------------------------
-String description
-int cost //price in cents
----------------------------
+ [constructor, getters, and a toString() method]
• (Assume
class Item has already been coded)
Class GroceryBag (Highlights)
----------------------------------
-bag // an ArrayList of
<Item>
----------------------------------
assume public methods: constructor, totalBag(), findItem(String
it), listAll(), etc.
• The
ONLY thing you need to do in the space below is to
write java code for the complete method specified:
• In
the space below, write code for a complete method
void showCheapItems()
that will use the ArrayList
bag and which will display all
Items in the bag whose price is below the overall average
of
all the prices of all the items in the bag.
[Hint: average will be the sum divided by the number of
items].
Required: use at least one for-each loop as part of your
method.
please help quickly!!!!!
In: Computer Science
Research and include the following:
In: Computer Science
Consider the following Java program. Describe what it does in response to specific operations of the mouse, and how it does it. (You are encouraged to run the program for yourself to test its behavior. Then read through the program carefully to understand how that behavior arises.)
import java.awt.event.*;
import javax.swing.*;
public class MouseWhisperer extends JFrame implements MouseListener
{
MouseWhisperer() {
super("COME
CLOSER");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addMouseListener(this);
setVisible(true);
}
public void mouseClicked(MouseEvent e) {
setTitle("OUCH"); }
public void mousePressed(MouseEvent e) {
setTitle("LET GO"); }
public void mouseReleased(MouseEvent e) {
setTitle("WHEW"); }
public void mouseEntered(MouseEvent e) {
setTitle("I SEE YOU"); }
public void mouseExited(MouseEvent e) {
setTitle("COME CLOSER"); }
public static void main(String[] args) { new
MouseWhisperer(); }
}
In: Computer Science
Implement the Metropolis-Hastings algorithm below¶
Make sure to read this: Implement the algorithm described above (in the "How it works" section), where you take some user-defined number of steps that randomly step in W and I and are scaled by a step_size. This means you don't want to take steps of a discrete size, but instead use a random distribution of step sizes that are scaled by your step_size variable. You'll want to take steps that have an equal chance of either decrementing or incrementing the values of W and I. Also, W and I don't have to incremented by the exact same amount, in fact, it would best if they weren't so that you can explore more of the parameter space.
Keep track of your accepted guesses for width and intercepts in the lists that are provided below. We have included variables with reasonable values of these quantities to get you started.
# Total number of points we're going to sample (start out with
at least 10^4)
num_sample_points = 100000
# Weight factor in front of the random step
step_size = 0.1
# As we move the walker around, we'll use these same lists
to
# store our new values so that we can visualize the path later!
# (Note: that means you'll want to append new values to these lists!)
widths = [2]
intercepts = [2]
## PUT YOUR CODE HERE ###
In: Computer Science
in c++ codeblocks
Convert the following code into a switch structure. Make the switch structure as short as possible (do not repeat code). if (i == 3 || i == 5) { n++; tryagain = 0; } else if (i == 4) || i == 10) { n = 5; } else if (i == 6) { n = 6; } else { n = 0; tryagain = 1; }
Write an if statement that will give 5 extra credit points to students who answer Question A correctly, and 10 extra points if they answer Question A and Question B correctly. Name the variable intBonus.
In: Computer Science
comparision of 8T SRAM and 6T SRAM cells with simulation graphs ?
In: Computer Science
In: Computer Science
Answer the question:
Some IT security personnel believe that their organizations should
employ former computer criminals to identify weaknesses in their
organizations’ security defenses. Do you agree? Why or why not?
Notes:
answer by using your own words, please.
the name of the course is "Professional Computing Issues."
In: Computer Science
Suppose you have the following two data sequences: 1101110101100110, and 0101010101010010. What is the value you should put in the checksum field if those are the only data you have?
In: Computer Science
Write a java program that asks the user for a positive integer N and then calculates a new value for N based on whether it is even or odd: if N is even, the new N is N/2. (Use integer division.) if N is odd, the new N is 3*N + 1. Repeat with each new N until you reach the value 1. For example, say the initial value is 12. Then the successive values are:
12 (even, next value is 12/2)
6 (even, next value is 6/2)
3 (odd, next value is 3*3+1)
10 (even, next value is 10/2)
5 (odd, next value is 3*5+1)
16 (even, next value is 16/2)
8 (even, next value is 8/2)
4 (even, next value is 4/2)
2 (even, next value is 2/2)
1 (stop calculation)
In: Computer Science
The following problems deal with sign extension and overflow. Registers X0 and X1 hold the values as shown in the table below. You will be asked to perform LEGv8 operations on these registers and show the result for the contents of A and B in the table 2 following.
|
A. |
X0 = 0x7000000016 |
X1 = 0x0FFFFFFF16 |
|
B. |
X0 = 0x4000000016 |
X1 = 0x4000000016 |
Table 2.
ADD X4, X0, X1
SUB X4, X0, X1
ADD X4, X0, X1
ADD X4, X0, X0
In: Computer Science
Convert the Queue to Generic implementation:
public class MyQueueImpl implements MyQueue {
private int capacity;
private int front;
private int rear;
private int[] arr;
public MyQueueImpl(int capacity){
this.capacity = capacity;
this.front = 0;
this.rear = -1;
this.arr = new
int[this.capacity];
}
@Override
public boolean enQueue(int v) {
if(this.rear ==
this.capacity - 1) {
//Perform shift
int tempSize = this.size();
for(int i=0; i < tempSize; i++) {
arr[i] = arr[front];
front++;
}
front = 0;
rear = tempSize - 1;
}
this.rear
++;
arr[rear] =
v;
return
true;
}
@Override
public int deQueue() {
return arr[front++];
}
public String toString() {
String content = "Queue :: ";
for(int i=front; i<= rear; i++)
{
content += "\n"
+ arr[i];
}
return content;
}
@Override
public boolean isFull() {
return (this.size() ==
this.capacity);
}
@Override
public int size() {
return rear - front + 1;
}
@Override
public boolean isEmpty() {
// TODO Auto-generated method
stub
return (this.size() == 0);
}
@Override
public int peek() {
// TODO Auto-generated method
stub
return this.arr[this.front];
}
}
In: Computer Science
Linux
Have your script request a word from the user, then checks if it is an ordinary file. If yes display the size of the file. If the name is a directory, then display the number of objects in that directory, then display the second line of a long listing of that directory.
In: Computer Science
in assemby, please share code and output - thanks
1. First clear all your general purpose registers by moving the value “0” into them. Initialize a variable for a BYTE, WORD, DWORD storage size each with any desired value in the data segment. Initialize another variable called Result with the size of a DWORD and make the value as an uninitialized value. In the code segment, create a label called L1 that moves the variables in the appropriate sized register and making sure NOT to overwrite them in the process. After, create another label L2 that adds all these values together and at the end of your program make sure your ECX register contains the final value. Call the DUMPREGS instruction to display your register values and move the final result into the Result variable.
2. Use the following code below as a template and follow the instructions written in the comments ;Assume I have the following data segment written: .data val1 BYTE 10h val2 WORD 8000h val3 DWORD 0FFFFh val4 WORD 7FFFh ;1. Write an instruction that increments val2. ;2. Write an instruction that subtracts val3 from EAX. ;3. Write instructions that subtract val4 from val2. .code ;Write your instructions here
In: Computer Science