In: Computer Science
a)The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________.
b)The decimal equivalent of the unsigned 8-bit hex number 0B4H is ______________.
c)The value of the expression ‘H’ – ‘B’ is less than / equal to / greater than that of the expression ‘L’ – ‘C’.
d)If the .data segment contains declarations
A BYTE 2 DUP (‘a’), ‘+’
B BYTE 3 DUP (‘b’), 0
C BYTE 4 DUP (‘c’), ‘–’
D BYTE 5 DUP (‘d’), 0
then the instruction
input A, D, 6
will display a Windows dialog box with title _______________________________.
f)If eax = 302B59A1H, and ebx = 700CD37DH, then the instruction
add ax, bx
will leave the value ______________________________ in the eax register.
In: Computer Science
Hey guys,
So it seems like I made a slight error in my program. So one of the requirement for this program is not to show any negatives shown as a output, however my program showed some negative numbers. I was wondering if someone could look over my program and find the error and maybe give it a tweak. I don't want to change my program because I worked so hard for it. Anyway here the assignment at the bottom is my code. Thanks in advance:
In this program, you are to store information about sales people and their individual sales from a company. You are to store the first name and quantity sold for each transaction.
You are to allow records to be stored for sales transactions. In fact, you need to ask the user for the total possible number of sales.
You are to allow data entry of 0 to maximum number of transaction. You are to store in the computer the income for each person for each transaction. No negative sales permitted. Here are the rules for calculating income:
The income for a person is progressive. He or she makes money for the first 5 items sold + money from the next 5 items sold + money for the next 500 items sold + the money for any other sale.
The program will have three options: * Record a new sale, * Show income from each existing sales transaction, * Quit
Example output
Name Total Items Sold Total Income
Tom 1 $5.00
Mary 5 $25.00
Willie 7 $35.00
Jack 511 $12,610
My code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
float incomePower(int itemSold){
float incomes;
int numbers = 4;
int breakpoints[] = {0, 5, 5+5, 5+5+500};
float rates[] = {5.0, 10.0, 25.0, 35.0};
for (int roc = 0; roc < numbers; roc++) {
if (itemSold <= breakpoints[roc]) {
break;
}
if ( roc < numbers - 1 && itemSold >= breakpoints[roc + 1]) {
incomes += rates[roc] * (breakpoints[roc + 1] - breakpoints[roc]);
} else {
incomes += rates[roc] *(itemSold - breakpoints[roc]);
}
}
return incomes;
}
int main(){
int megaSale = 0, roc = 0, arrayPointer = 0;
printf("\nThe total income of sales of each Person\n");
printf("\nEnter the maximum number of sales: \n");
scanf("%d", &megaSale);
char names[megaSale][100];
int itemsold[megaSale];
float totalincome[megaSale];
while (1) {
int choice;
printf("Choose:");
scanf("%d", &choice);
switch (choice) {
case 1:
printf("Enter the name of sales person");
scanf("%s", names[arrayPointer]);
printf("Enter the number of sale of %s: ", names[arrayPointer]);
scanf("%d", &itemsold[arrayPointer]);
totalincome[arrayPointer] = incomePower(itemsold[arrayPointer]);
arrayPointer += 1;
break;
case 2:
printf("\nName\t\tTotal Items Sold\t\tTotal Income");
for (roc = 0; roc <arrayPointer; roc++) {
printf("\n%s\t\t\t%d\t\t\t%.2f\n", names[roc], itemsold[roc], totalincome[roc]);
}
break;
case 3:
exit(0);
break;
default:
printf("Invalid entry");
}
}
return 0;
}
In: Computer Science
Discuss in 500 words or more federated architecture in cloud systems. Remember that this is a cloud class not a database class
Note-Check in chegg writing before you submit it should be 100% unique and don't submit the existing chegg answers,and submit in text format
Provide References
In: Computer Science
In: Computer Science
Write a paragraph to reflect on what you have learned in this assignment in terms of the difference between relational databases versus spreadsheets. Discuss ways in which a relational database could be useful for your work (if you have a job) or for your personal or professional projects (if you are a full-time student)
In: Computer Science
void main()
{
Grade g1; //object for grade
char h;
cout << "enter character" ;
cin>>h; //getting value
g1.grade(h);
g1.print();
getch();
}
create an output file (named “output.txt”), and save the character to this output file. Last, close this output file
In: Computer Science
(C++) I'm getting a few errors that prevents the program from running what is causing this?
"
routes3.cpp:202:9: warning: add explicit braces to avoid dangling else
[-Wdangling-else]
else {
^
"
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <cstring>
using namespace std;
class Leg{
const char* const startCity;
const char* const endCity;
const int dist;
public:
Leg(const char* const, const char* const, int);
Leg& operator= (const Leg&);
int getDist() const {return dist;}
void output(ostream&) const;
friend class Route;
friend class ShortestRoute;
};
class Route{
friend class ShortestRoute;
vector<const Leg*> legs;
const int dist;
public:
Route(const Leg&);
Route(const Route&, const Leg&);
Route& operator=(const Route&);
int getDistance() const {return dist;}
void output(ostream&) const;
friend bool operator<(const Route&, const Route&);
};
class ShortestRoute
{
static const int legSize;
static const Leg legs[];
public:
static const Route anyRoute(const char* const, const char*
const);
static const Route shortestRoute(const char* const, const char*
const);
};
const Leg ShortestRoute::legs[] =
{
Leg("Denver", "Kansas City", 395),
Leg("Philadelphia", "New York", 96),
Leg("Oklahoma City", "Kansas City", 347),
Leg("San Jose", "Las Vegas", 382),
Leg("San Fransisco", "San Jose", 42),
Leg("San Jose", "Los Angeles", 306),
Leg("Albuquerque", "Dallas", 646),
Leg("Pittsburgh", "New York", 371),
Leg("Los Angeles", "Phoenix", 372),
Leg("Phoenix", "Albuquerque", 421),
Leg("Las Vegas", "Albuquerque", 573),
Leg("Sacramento", "Reno", 138),
Leg("Memphis", "Atlanta", 383),
Leg("Albuquerque", "Kansas City", 617),
Leg("Albuquerque", "Oklahoma City", 541),
Leg("Oklahoma City", "St Louis", 498),
Leg("Cincinnati", "Columbus", 102),
Leg("Cincinnati", "Cleveland", 217),
Leg("Oklahoma City", "Memphis", 467),
Leg("Dallas", "Memphis", 451),
Leg("Richmond", "Washington", 109),
Leg("Chicago", "Indianapolis", 183),
Leg("Indianapolis", "Cincinnati", 115),
Leg("Los Angeles", "Las Vegas", 263),
Leg("Los Angeles", "Albuquerque", 789),
Leg("Louisville", "Cincinnati", 100),
Leg("St Louis", "Indianapolis", 243),
Leg("Washington", "Baltimore", 39),
Leg("Baltimore", "Philadelphia", 105),
Leg("Las Vegas", "Denver", 754),
Leg("Las Vegas", "Salt Lake City", 420),
Leg("Reno", "Salt Lake City", 518),
Leg("Salt Lake City", "Denver", 519),
Leg("Kansas City", "Chicago", 510),
Leg("Memphis", "Louisville", 383),
Leg("San Fransisco", "Sacramento", 90),
Leg("Memphis", "Nashville", 210),
Leg("Kansas City", "St Louis", 249),
Leg("Nashville", "Charlotte", 409),
Leg("Atlanta", "Charlotte", 226),
Leg("Detroit", "Cleveland", 169),
Leg("Cleveland", "Pittsburgh", 134),
Leg("Louisville", "Richmond", 563),
Leg("Pittsburgh", "Washington", 241),
Leg("Pittsburgh", "Philadelphia", 304),
Leg("Chicago", "Detroit", 283),
Leg("Columbus", "Pittsburgh", 142),
Leg("Charlotte", "Richmond", 291),
//SF to NY SuperHighway
Leg("San Fransisco", "New York", 21000)
};
int main(){
cout << endl << "Programmer: \n";
cout << "Course: \n";
const Route route1 = ShortestRoute::anyRoute("San Francisco",
"New York City");
route1.output(cout);
const Route route2 = ShortestRoute::shortestRoute("San
Francisco", "New York City");
route2.output(cout);
return 0;
}
const Route ShortestRoute::anyRoute(const char* const start,
const char* const end) {
for (int i = 0; i < ShortestRoute::legSize; i++) {
if (strcmp(ShortestRoute::legs[i].endCity, end) == 0) {
if (strcmp(ShortestRoute::legs[i].startCity, start) == 0) {
Route r(legs[i]);
return r;
}
else {
Route
x(ShortestRoute::anyRoute(start,ShortestRoute::legs[i].startCity),legs[i]);
return x;
}
}
}
throw "Can't find a possible route!";
}
const Route ShortestRoute::shortestRoute(const char* const
start, const char* const end){
set<Route> s;
for (int i = 0; i < ShortestRoute::legSize; i++) {
for (int j = 0; j < ShortestRoute::legSize; j++) {
if (strcmp(ShortestRoute::legs[i].endCity, end) == 0)
if (strcmp(ShortestRoute::legs[i].startCity, start) == 0) {
Route r(legs[i]);
return r;
}
else {
Route x(ShortestRoute::anyRoute(start,
ShortestRoute::legs[i].startCity), legs[i]);
s.insert(x);
}
}
}
return *(s.begin());
}
bool operator<(const Route& a, const Route& b)
{
return a.dist < b.dist;
}
Leg& Leg::operator=(const Leg& copy){
Leg& host = *this;
if(this != ©){
const_cast<const char*&>(host.startCity) =
copy.startCity;
const_cast<const char*&>(host.endCity) =
copy.endCity;
const_cast<int&>(host.dist) = copy.dist;
}
return host;
}
void Leg::output(ostream& os) const{
os << startCity << " to " << endCity << "
is " << dist << " miles" << endl;
}
Route::Route(const Leg& leg) : dist(leg.getDist()){
legs.push_back(&leg);
}
Route::Route(const Route& route, const Leg& leg)
: legs(route.legs), dist(route.dist+leg.dist){
if (strcmp(route.legs.back()->endCity, leg.startCity) !=
0)
throw "Mismatch";
legs.push_back(&leg);
}
void Route::output(ostream& os) const{
string output = "Route: ";
string temp = " to ";
int totalDist = 0;
for(int i = 0; i < legs.size(); i++){
output += legs[i]->startCity;
if(i != legs.size()-1) {
output += temp;
}
else{
output += (temp + legs[i]->endCity);
}
totalDist += legs[i]->getDist();
}
output += (" "+to_string(totalDist)+" miles\n");
os << output;
}
Route& Route::operator=(const Route& copy){
Route& host = *this;
if(this != ©){
const_cast<int&>(host.dist) = copy.getDistance();
host.legs = copy.legs;
}
return host;
}
In: Computer Science
For this exercise, you will implement two programs that allow the user to enter grades in a gradebook. The first program will use one‐dimensional arrays, and the second program will use two‐dimensional arrays. The two programs function the same
Write an application that prints out the final grade of the students in a class and the average for the whole class. There are a total of 3 quizzes. You will need 4 arrays:
1. An array of type int to store all the ID's
2. An array of type double to store all scores for quiz 1
3. An array of type double to store all scores for quiz 2
4. An array of type double to store all scores for quiz 3
How to proceed:
1. Ask the user how many students are in the class, so you can set the length of all the arrays.
2. Allocate 4 arrays that will store the data.
3. Use a FOR loop to retrieve and store all the data.
4. Use another FOR loop to
a. Output the final score for each student.
b. Keep track of all scores to later compute the average for the class.
5. Calculate and Output the average for the class.
Format all floating‐point numbers to 2 decimal places
Your program MUST receive user input as shown in the sample output.
Please leave comments on the program so i can give you a thumbs up :)!
Also, this is for java language.
In: Computer Science
Subject: Security Policy & Procedures
Describe what a Data Flow Diagram is and why it is useful for IT auditing. One paragraph should describe what a Data Flow Diagram is, and the second paragraph should describe why it is useful for IT auditing.
In: Computer Science
You will need to use only two arrays: One array of type int to store all the ID's
One two‐dimensional array of type double to store all the scores for all quizzes
Note: The two dimensional array can be represented also with the rows being the students and the columns being the quizzes.
How to proceed:
1. Declare the number of quizzes as a constant, outside the main method. (Recall that identifiers for constants are all in CAPITAL_LETTERS.)
2. Ask the user how many students are in the class, so you can set the length of all the arrays.
3. Allocate 2 arrays, one one‐dimensional and the other two‐dimensional, that will store the data.
4. Use two nested FOR loops to retrieve and store all the data.
5. Use another two nested FOR loops to
a. Output the final score for each student.
b. Keep track of all scores to later compute the average for the class.
6. Calculate and Output the average for the class.
Format all floating‐point numbers to 2 decimal places.
Please leave comments on the program so i can give you a thumbs up :)!
also, this is for java language
In: Computer Science
Assembly Language Programming:
a)If eax = 0FFFFFFFFH, and edx = 0FFFFFFFFH, then the instruction
imul edx
will leave the value ______________________________ in the edx register.
b)If eax = 0D000000DH, and edx = 50000005H, then the instruction
idiv dl
will leave the value ______________________________ in the eax register.
c)If ax = 3BC4H, then the following instructions
cmp ah, al
jg Label
will / will not cause a jump to Label.
d)If ax = 3BC4H, then the following instructions
cmp ah, al
ja Label
will / will not cause a jump to Label.
f) The following instructions
mov eax, 0
mov ecx, 1100B
L1: inc eax
loop L1
will leave the value ______________________________ in the eax register.
In: Computer Science
Given a string str of even length, print out the first half.
Methods to use: substring(), length()
Testing cases:
WooHoo => Woo
HelloThere => Hello
abcdef => abc
ab => a
0123456789 => 01234
kitten => kit
(Note that the sample input test cases are shown before the “=>” and the expected output each test case is after the “=>”.
Your program should print out the expected output only, not the input.)
In: Computer Science
3. What are some issues that can arise when importing data from an outside
source into a DBMS? What are some tools or ways to resolve these issues?
4. Why do tables have to be related in Access for queries to work correctly?
5. What are the benefits and drawbacks for using a DBMS vs. a spreadsheet
to store data?
In: Computer Science
Describe and explain the advantages and disadvantages of network-based and host-based intrusion detection categories.
In: Computer Science