Take a critical look at three GUI applications you have used—for example, a spreadsheet, a word-processing program, and a game. Describe how well each conforms to the GUI design guidelines listed in this chapter.
In: Computer Science
Prove that P1, P2 ⊢ C
P1: (∀x)(∃y)(P(x) ⇒ (Q(y) ∧ T(x, y)∧ ∼ S(x, y)))
P2: (∃x)(∀y)(P(x) ∧ ((Q(y) ∧ R(x, y)) ⇒ S(x, y)))
C: ∼ (∀x)(∀y)((P(x) ⇒∼ T(x, y)) ∨ (Q(y) ⇒ R(x, y)))
In: Computer Science
For this exercise you will use the Order Entry (oe) schema that is one of the sample schemas in Oracle.
Table 4-2 Order Entry (OE) Schema Scripts
Script Name | Description |
---|---|
oc_comnt.sql | Adds comments to the online catalog (OC) subschema wherever possible. |
oc_cre.sql | Creates the OC subschema. |
oc_drop.sql | Drops the OC subschema. |
oc_main.sql | Main script for the OC subschema. |
oc_popul.sql a | Populates the object tables. |
oe_analz.sql | Gathers statistics on the OE objects. |
oe_comnt.sql | Creates comments for the objects in the schema. |
oe_cre.sql | Creates the OE objects. |
oe_drop.sql | Drops the OE schema and all its objects. |
oe_idx.sql | Creates indexes on the OE tables. |
oe_main.sql | Main script for the OE schema; calls other scripts. |
oe_views.sql | Creates the OE schema views. |
List of OE Objects
FUNCTION GET_PHONE_NUMBER_F INDEX CUSTOMERS_PK CUST_ACCOUNT_MANAGER_IX CUST_EMAIL_IX CUST_LNAME_IX CUST_UPPER_NAME_IX INVENTORY_IX INV_PRODUCT_IX ITEM_ORDER_IX ITEM_PRODUCT_IX ORDER_ITEMS_PK ORDER_ITEMS_UK ORDER_PK ORD_CUSTOMER_IX ORD_ORDER_DATE_IX ORD_SALES_REP_IX PRD_DESC_PK PRODUCT_INFORMATION_PK PROD_NAME_IX PROD_SUPPLIER_IX PROMO_ID_PK REFERENCE_IS_UNIQUE SYS_C003584 SYS_C003587 SYS_C003588 SYS_C003589 SYS_C003590 WAREHOUSES_PK WHS_LOCATION_IX LOB SYS_LOB0000045843C00022$$ SYS_LOB0000045843C00023$$ SYS_LOB0000045852C00003$$ SYS_LOB0000045852C00012$$ SYS_LOB0000045852C00013$$ SYS_LOB0000046019C00004$$ SYS_LOB0000046019C00005$$ SYS_LOB0000046019C00007$$ SYS_LOB0000046019C00011$$ SYS_LOB0000046019C00012$$ SYS_LOB0000046019C00015$$ SYS_LOB0000046019C00024$$ SYS_LOB0000046019C00031$$ SYS_LOB0000046019C00032$$ SYS_LOB0000046044C00003$$ SEQUENCE ORDERS_SEQ SYNONYM COUNTRIES DEPARTMENTS EMPLOYEES JOBS JOB_HISTORY LOCATIONS TABLE CATEGORIES_TAB CUSTOMERS INVENTORIES ORDERS ORDER_ITEMS PRODUCT_DESCRIPTIONS PRODUCT_INFORMATION PRODUCT_REF_LIST_NESTEDTAB PROMOTIONS PURCHASEORDERS STYLESHEET_TAB SUBCATEGORY_REF_LIST_NESTEDTAB WAREHOUSES TRIGGER INSERT_ORD_LINE ORDERS_ITEMS_TRG ORDERS_TRG PURCHASEORDERS$xd TYPE CATALOG_TYP CATALOG_TYP CATEGORY_TYP CATEGORY_TYP COMPOSITE_CATEGORY_TYP COMPOSITE_CATEGORY_TYP CORPORATE_CUSTOMER_TYP CUSTOMER_TYP CUST_ADDRESS_TYP INVENTORY_LIST_TYP INVENTORY_TYP LEAF_CATEGORY_TYP LEAF_CATEGORY_TYP ORDER_ITEM_LIST_TYP ORDER_ITEM_TYP ORDER_LIST_TYP ORDER_TYP PHONE_LIST_TYP PRODUCT_INFORMATION_TYP PRODUCT_REF_LIST_TYP SUBCATEGORY_REF_LIST_TYP SYS_YOID0000046073$ SYS_YOID0000046075$ SYS_YOID0000046077$ SYS_YOID0000046079$ SYS_YOID0000046081$ WAREHOUSE_TYP XDBPO_ACTIONS_TYPE XDBPO_ACTION_COLLECTION XDBPO_ACTION_TYPE XDBPO_LINEITEMS_TYPE XDBPO_LINEITEM_COLLECTION XDBPO_LINEITEM_TYPE XDBPO_PART_TYPE XDBPO_REJECTION_TYPE XDBPO_SHIPINSTRUCTIONS_TYPE XDBPO_TYPE TYPE BODY CATALOG_TYP COMPOSITE_CATEGORY_TYP LEAF_CATEGORY_TYP VIEW ACCOUNT_MANAGERS BOMBAY_INVENTORY CUSTOMERS_VIEW DEPTVIEW OC_CORPORATE_CUSTOMERS OC_CUSTOMERS OC_INVENTORIES OC_ORDERS OC_PRODUCT_INFORMATION ORDERS_VIEW PRODUCTS PRODUCT_PRICES SYDNEY_INVENTORY TORONTO_INVENTORY
OE Table Descriptions
Table CATEGORIES_TAB Name Null? Type ----------------------------------------- -------- ---------------------------- CATEGORY_NAME VARCHAR2(50) CATEGORY_DESCRIPTION VARCHAR2(1000) CATEGORY_ID NOT NULL NUMBER(2) PARENT_CATEGORY_ID NUMBER(2) Table CUSTOMERS Name Null? Type ----------------------------------------- -------- ---------------------------- CUSTOMER_ID NOT NULL NUMBER(6) CUST_FIRST_NAME NOT NULL VARCHAR2(20) CUST_LAST_NAME NOT NULL VARCHAR2(20) CUST_ADDRESS CUST_ADDRESS_TYP PHONE_NUMBERS PHONE_LIST_TYP NLS_LANGUAGE VARCHAR2(3) NLS_TERRITORY VARCHAR2(30) CREDIT_LIMIT NUMBER(9,2) CUST_EMAIL VARCHAR2(30) ACCOUNT_MGR_ID NUMBER(6) CUST_GEO_LOCATION MDSYS.SDO_GEOMETRY DATE_OF_BIRTH DATE MARITAL_STATUS VARCHAR2(20) GENDER VARCHAR2(1) INCOME_LEVEL VARCHAR2(20) Table INVENTORIES Name Null? Type ----------------------------------------- -------- ---------------------------- PRODUCT_ID NOT NULL NUMBER(6) WAREHOUSE_ID NOT NULL NUMBER(3) QUANTITY_ON_HAND NOT NULL NUMBER(8) Table ORDERS Name Null? Type ------------------------------------ -------- ---------------------------- ORDER_ID NOT NULL NUMBER(12) ORDER_DATE NOT NULL TIMESTAMP(6) WITH LOCAL TIME ZONE ORDER_MODE VARCHAR2(8) CUSTOMER_ID NOT NULL NUMBER(6) ORDER_STATUS NUMBER(2) ORDER_TOTAL NUMBER(8,2) SALES_REP_ID NUMBER(6) PROMOTION_ID NUMBER(6) Table ORDER_ITEMS Name Null? Type ----------------------------------------- -------- ---------------------------- ORDER_ID NOT NULL NUMBER(12) LINE_ITEM_ID NOT NULL NUMBER(3) PRODUCT_ID NOT NULL NUMBER(6) UNIT_PRICE NUMBER(8,2) QUANTITY NUMBER(8) Table PRODUCT_DESCRIPTIONS Name Null? Type ----------------------------------------- -------- ---------------------------- PRODUCT_ID NOT NULL NUMBER(6) LANGUAGE_ID NOT NULL VARCHAR2(3) TRANSLATED_NAME NOT NULL NVARCHAR2(50) TRANSLATED_DESCRIPTION NOT NULL NVARCHAR2(2000) Table PRODUCT_INFORMATION Name Null? Type ----------------------------------------- -------- ---------------------------- PRODUCT_ID NOT NULL NUMBER(6) PRODUCT_NAME VARCHAR2(50) PRODUCT_DESCRIPTION VARCHAR2(2000) CATEGORY_ID NUMBER(2) WEIGHT_CLASS NUMBER(1) WARRANTY_PERIOD INTERVAL YEAR(2) TO MONTH SUPPLIER_ID NUMBER(6) PRODUCT_STATUS VARCHAR2(20) LIST_PRICE NUMBER(8,2) MIN_PRICE NUMBER(8,2) CATALOG_URL VARCHAR2(50) PRODUCT_REF_LIST_NESTEDTAB Name Null? Type ----------------------------------------- -------- ---------------------------- COLUMN_VALUE NUMBER(6) Table PROMOTIONS Name Null? Type ----------------------------------------- -------- ---------------------------- PROMO_ID NOT NULL NUMBER(6) PROMO_NAME VARCHAR2(20) Table PURCHASEORDERS Name Null? Type ----------------------------------------- -------- ---------------------------- TABLE of SYS.XMLTYPE(XMLSchema "http://www.oracle.com/xdb/ord.xsd" Element "PurchaseOrder") STORAGE Object-relational TYPE "XDBPO_TYPE" Table STYLESHEET_TAB Name Null? Type ----------------------------------------- -------- ---------------------------- ID NUMBER STYLESHEET XMLTYPE Table SUBCATEGORY_REF_LIST_NESTEDTAB Name Null? Type ----------------------------------------- -------- ---------------------------- COLUMN_VALUE REF OF CATEGORY_TYP Table WAREHOUSES Name Null? Type ----------------------------------------- -------- ---------------------------- WAREHOUSE_ID NOT NULL NUMBER(3) WAREHOUSE_SPEC SYS.XMLTYPE WAREHOUSE_NAME VARCHAR2(35) LOCATION_ID NUMBER(4) WH_GEO_LOCATION MDSYS.SDO_GEOMETRY
Write a SQL statement to show all non-married customers’ full name, gender, income_level and total amount spent on the product ‘Video Card /32’ AND whose credit limit is less than 700.
Write a SQL statement to show the total amount spent on products summarized by Category and each month of each year (YYYY-MM); Order the results in descending order of YYYY-MM
Write a SQL statement to show the total amount spent on products summarized by product category and Year, along with RANK within each year (order by increasing RANK of amount spent)
Write a SQL statement to show the product category names of the products that have the smallest percentage discount (that is non-zero) off of the Product_information.list_price. (Display the top 10).
Who is the “best” customer? Justify your rationale and back it up with a query showing the data. You may also wish to graph your data to support your justification.
Write a query that shows each month/year total sales by state along with a column that shows the difference from the prior month/year sales. (Hint: Look at the LAG function)
Create a VIEW in your own schema that joins together all of the columns in the Customers, Orders, Order_items, Product_information and categories_tab. Be sure to “flatten” the CUST_ADDRESS, phone numbers and CUST_GEO_LOCATION. (See below Note on ‘flattening’)
Import all of the data from your VIEW into Microsoft Excel. Create a pivot table from the resulting data set and then summarize the data according to total sales by category_name and customer credit limit.
Import all of the data from your view into Tableau. Create an appropriate visualization from the resulting data set that summarizes the data according to total sales by category_name and customer income level over time.
In: Computer Science
In: Computer Science
C++ code won't run. Fix?
//==========================================================
#include <conio.h> // For function getch()
#include <cstdlib> // For several general-purpose
functions
#include <fstream> // For file handling
#include <iomanip> // For formatted output
#include <iostream> // For cin, cout, and system
#include <string> // For string data type
using namespace std; // So "std::cout" may be abbreviated to
"cout"
//Converting hexadecimal to binary
int main()
{
char binarynum[65], hexa[17];
//Using long int because it has greater capacity
long int i = 0;
printf("Enter the hex value that needs to convert
to binary: ");
scanf_s("%s", hexa);
printf("\n The converted hex value in binary is:
");
while (hexa[i])
{
//These are the different cases for
the binary that will be converted from hex. Case is the hex code
and printf is the binary output.
//It scans the inputs and then
compares it to switch case that is below.
switch (hexa[i])
{
case '0':
printf("0000");
break;
case '1':
printf("0001");
break;
case '2':
printf("0010");
break;
case '3':
printf("0011");
break;
case '4':
printf("0100");
break;
case '5':
printf("0101");
break;
case '6':
printf("0110");
break;
case '7':
printf("0111");
break;
case '8':
printf("1000");
break;
case '9':
printf("1001");
break;
case 'A':
printf("1010");
break;
case 'B':
printf("1011");
break;
case 'C':
printf("1100");
break;
case 'D':
printf("1101");
break;
case 'E':
printf("1110");
break;
case 'F':
printf("1111");
break;
case 'a':
printf("1010");
break;
case 'b':
printf("1011");
break;
case 'c':
printf("1100");
break;
case 'd':
printf("1101");
break;
case 'e':
printf("1110");
break;
case 'f':
printf("1111");
break;
//
default:
printf("\n
Invalid hexa digit entered ", hexa[i]);
return 0;
}
i++;
}
cout << "Press any key to
exit ..." << endl;
_getch();
}
In: Computer Science
// This program ask the user to enter a character. It then performs a
// linear search on a character array and display the number of times
// that the character appears on the array. If the character is not in the
// array, then it will display a message saying that is was not found.
// Add the necessary code for the program to work.
// NOTE:
// You don't have to edit anything in the main(), just in the searchArray() function.
// EXAMPLES:
// Input: Enter a letter to search for: h
// Output: The are 2 number of 'h' letters in the list
// Input: Enter a letter to search for: n
// Output: The are 2 number of 'n' letters in the list
// Input: Enter a letter to search for: z
// Output: The letter z was not found in the list
#include<iostream>
using namespace std;
int searchArray(char[], int, char); // function prototype
const int SIZE = 10;
int main()
{
//char charArray[SIZE] = {'h', 'h', 'a', 'r', 'p', 'o', 'o', 'n', 'n', '\0'};
char charArray[SIZE] = "hharpoonn";
int found;
char ch;
cout << "Enter a letter to search for: ";
cin >> ch;
found = searchArray(charArray, SIZE, ch);
if (found == 0)
cout << "The letter " << ch
<< " was not found in the array" << endl;
else
cout << "The are " << found << " number of '" << ch
<<"' letters in the array" << endl;
return 0;
}
//*******************************************************************
// searchArray
//
// task: This searches an array for a particular value
// data in: Array of values, the number of
// elements in the array, and the value searched for
// in the array
// data returned: Number of times the value appears in the list or 0
// if the value is not found
//
//*******************************************************************
int searchArray(char array[], int numElems, char value)
{
// Counter, contains the number of times the character appears on the array.
int count = 0;
// Add code to search the array and count the number of times the
// character appears in it.
// HINT: for-loop similar to the one in linearSearch.cpp
// Complete the return statement. If the value is found, returns the
// number of characters founded. If the value is not found, 0 is returned.
return _________;
}
In: Computer Science
Choose a topic from the course book. Explain the concept and discuss how the topic is relevant in today's cyber strategic operations. You may use the provided chapters of the book if you do not have the book. See link on the home page of this course.
*2 page answer
In: Computer Science
Linked List:
Complete the following code to create a linked list from an Array. After creating the list, display the elements of the linked list iteratively.
Write two others function called as RDisplayTailRecursion(first) and RDisplayTailRecursion(first) which will print elements of the linked list using the tail and head recursions respectively.
#include <stdio.h>
#include <stdlib.h>
struct Node
{
}*first=NULL;
void create(int A[], int n)
{
for(i=1; i<n; i++)
{
}
}
void Display(struct Node*p)
{
while(p!=NULL)
{
}
}
void RDisplayTailRecursion (struct Node*p)
{
if(p!=NULL)
{
}
}
void RDisplayHeadRecursion (struct Node*p)
{
if(p!=NULL)
{
}
}
int main()
{
struct Node *temp;
int A[] = {3,5,7,10,25,8,32,2};
create(A,8);
Display(first);
printf("\n");
RDisplayTailRecursion(first);
RDisplayTailRecursion(first);
return 0;
}
In: Computer Science
Caesar Cipher in Java Problem?
Objective
Practice the cumulative sum and char data type
Problem
You want to create an app to encrypt the text messages that you send to your friends. Once your friend gets the message, the message should be decrypted so that your friend understands it. To implement this app Caesar cipher algorithm should be used. Caesar Cipher text is formed by rotating each letter by a given amount. For example, if you rotate the letter ‘A’ by 3 you should get ‘D’. rotate ‘B’ by 3 you should get ‘E’. Toward the end of the alphabet you wrap around, if example rotate ‘X’ by 3 you should get ‘A’. rotate ‘Y’ by 3 you should get ’B’
Methods
Public static void main(String[] args)
public static void run(Scanner kb)
Public static String encrypt (String message, int key)
{
Convert the message to uppercase using the method toUpperCase from the String class
Declare a variable of type string called result to hold the encrypted message, initialize it to “”;
Create a loop to go through each letter of the message
{
Get each letter and store it in a variable of type char called c, use the charAt method: char c = message.charAt(i)
If the letter is between ‘A’ and ‘Z’
{
Add the key to the letter: c = c + key
//checking for wrap around
If c is greater than ‘Z’
{
Subtract 26 from c
}
else
{
Add 26 to c
}
}//end of if
Add the content of the variable c to the variable result (cumulative sum)
}//end of the loop
Return result
}//end of the method
Public static String decrypt (String message, int key):
{
Declare a String called result and initialize it to “”
Create a for loop to go through each letter of the message
{
Get the character at each index char c = message.charAt(i)
If the variable c is between ‘A’ and ‘Z’
{
Subtract the value of the variable key from the variable c
If the content of the variable c is less than ‘A’ //check for wrap around
{
Find the difference between the letter ‘A’ and the variable c : int diff = ‘A’ - c
c = (char)(‘Z’ – diff + 1)
}
else if c > ‘Z’ //
{
Int diff = ‘Z’ - c
C = (char)((‘A’ + diff + 1)
}
}
Concatenate the variable c to the variable result
}//end for
Return result
}//end of the method
Requirements
Sample output:
How many times to you want to use the app: 4
Your message? I love java programming
Encoding key? 5
The encrypted message is:
N QTAJ OFAF UWTLWFRRNSL
The decrypted message is:
I LOVE JAVA PROGRAMMING
In: Computer Science
You are the Chief of Cybersecurity Operations at a National Palace. Your organization will host a Gala for distinguished visitors. Discuss how you would plan and what you would consider in order to keep the event Cyber secure.
*2 page answer
In: Computer Science
Understanding Operating Systems
It seems, in this tough economy, people are resorting to borrowing books and DVDs from the library rather than buying or renting from stores. Your library continues to thrive. You have expanded and added staff - besides you, you now have two library assistants, Peter and Jane. Peter is assigned to receive returned books, DVDs, and magazines, while Jane is in charge of lending out books and items.
As you only have a finite amount of titles to lend, you have also instituted a "Wait List" for your borrowers. If the book or DVD they're borrowing is not available, they will be put on the "waitlist". Note that for everyone's title, there could only be ONE borrower on the "waitlist" at a time.
Being new to your library, you must devise a system for Jane and Peter to follow so that:
i) Jane can check the "waitlist" when someone is borrowing
ii) Peter can update the "waitlist" when a book is returned
iii) If the book recently returned is immediately borrowed on the same day, Jane should be able to come to Peter to get the book and update the "waitlist" herself. Otherwise, Peter, at the end of the day, should put it back on the shelf.
iv) Jane and Peter can generate a report summarizing the titles borrowed and returned that day.
The key here is Jane and Peter should be synchronized in what they are going to do. Device a solution (an algorithm, pen-and-paper approach, or series of steps) to enable this new process. Software is not a solution (ie - use an SQL database or a third-party program). Apply methodologies such as test-and-set, Wait-and-signal, and semaphores to assist you in synchronization.
In: Computer Science
1.a. RISC-V has several addressing modes. Describe 4 addressing modes. For each, describe what it does and give an example assembly instruction that uses that addressing mode. b. Starting with a C source code file, describe the steps that must occur in order to actually begin executing the program on your computer.
In: Computer Science
provide a hypothetical situation involving “dirty data” and discuss how data pre-processing would address this issue
In: Computer Science
Represent the decision making involved in the operation of
the
following wash-machine by means of a decision table:
The machine waits for the start switch to be pressed. After the
user
presses the start switch, the machine fills the wash tub with
either hot
or cold water depending upon the setting of the HotWash switch.
The
water filling continues until the high level is sensed. The machine
starts
the agitation motor and continues agitating the wash tub until
either the
preset timer expires or the user presses the stop switch. After
the
agitation stops, the machine waits for the user to press the
startDrying switch. After the user presses the startDrying
switch,
the machine starts the hot air blower and continues blowing hot air
into
the drying chamber until either the user presses the stop switch or
the
preset timer expires.
In: Computer Science
Snakes and ladders is an ancient south Asian board game. It
consists of 10X10 grid board which
contains some snakes and ladders at specific boxes/indexes. One
hundred is the maximum and a must
to win score for each player. First player reaching 100 gets to win
the game and is immediately
declared as first Winner.
You are required to do the following:
Create a snake board of 10 rows and 10 columns.
Randomly generate 09 snakes on the board. In order to generate
snake you only need to know
head and tail of the snake. Make sure that both head and tail are
on the board. Moreover, if
head is on row (Mi) and tail is on row (Mj) then i will always be
less than j.
Similarly, generate 09 ladders on the board.
Print the snake board along with snakes and ladders on the
screen.
In order to start both the player need a six on the dice. Once
the game is started display the
output on the dice and wait for key press (you can use getch())
before second player’s turn.
Game will go on until one player wins the game.
In case player lands on a snake’s head it will come down to its
tail, here you need to display a
message “oops, snake got you!!!”
In case player lands on the bottom of the leader it will climb
the ladder, here you need to
display a message “you got lucky”
Note: Input validation is mandatory when reading taking input size
of the board.
In: Computer Science