Questions
For this question, you are given a negotiated statement of requirements and asked to produce a...

For this question, you are given a negotiated statement of requirements and asked to produce a structural model.

Here is the negotiated statement of requirements (NSR) for the PickMeNow System (PMNS):

PickMeNow is a new taxi company which has started its operations recently. In order to meet the on-demand transportation needs of its customers, PickMeNow has decided to invest in an IT solution to connect its customers and drivers.

Drivers and customers are required to register with PickMeNow by providing a name, contact number and an email address. PickMeNow assigns an identification number to each registered driver and customer. In addition, each driver is required to provide the details of his bank account (account number and bank name) and vehicle details as described below. Drivers can transfer the amount in his PickMeNow account to his bank account.

PickMeNow provides three types of vehicle to its customers: cars, vans and mini buses. For each vehicle, it is required to capture its licence plate number, brand and model. When a customer makes a booking for a mini bus, he has to make an upfront deposit amount. The deposit will be returned to the customer if the booking is not cancelled by the customer. For vans, there is a booking fee on top of the trip fare. If a customer cancels a booking for a mini bus, the deposit is forfeited if the cancellation is received 3 days before the date of the ride.

When a customer submits a booking to PickMeNow, he needs to specify the date and time, vehicle type, the pick-up point and destination of the trip. PickMeNow would generate a booking id, calculate the fare and broadcast this trip to all available drivers who are free to accept the booking. The customer would then choose a driver from the list of drivers who had accepted the booking. The chosen driver would then proceed to provide the taxi service to the customer.

The data to be kept for each ride includes a reference number, driver and customer details (identification number and name), fare, pick-up point, destination, distance, date, start time and end time of the ride. At the end of each ride, the driver’s account will be credited with the amount of the fare minus any fee due to PickMeNow.

After completing a ride, customers can accumulate points. After completing rides worth a total of $400, the customer will become a Premium customer. Only Premium customers can redeem their points to pay their bill. Points may be used to offset a customer’s bill and if there are insufficient points, the rest of the bill must be paid using a credit card.

Develop a structural model for the system design, by submitting your answers to the following:

(a) Identify the classes, their attributes and any hierarchical relationship(s), omitting the foreign key associations that would be required for the application. Submit the class description as your answer.

(b) Appraise the associations among the classes and hierarchical relationship(s) that would be required for the application. Construct the class-association diagram in UML as your answer. Any derived association should be labelled, but you need not give the derivation.

In: Computer Science

What is a clocked RS Flip-flop, explain its concept

What is a clocked RS Flip-flop, explain its concept

In: Computer Science

I'm have trouble change JRadioButton and do not want to select all at the same time...

I'm have trouble change JRadioButton and do not want to select all at the same time just one at a time. if one of them is unselected, then set the font as plain. Set font size as 20.

run the program and change the font and you see what I'm talking about

also this there anyway to shorten my code

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.Font;
import java.awt.event.*;
import java.net.URL;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import javax.swing.JCheckBox;
import javax.swing.JColorChooser;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.KeyStroke;
//MyMenuFrame will use Jframe with actionlistener
public class MyMenuFrame extends JFrame implements ActionListener{

//creating the main menu items
JMenu menuEdit = new JMenu("Edit");
JMenu menuPrint = new JMenu("Print");
JMenu mnFile = new JMenu("File");
JMenu menuHelp = new JMenu("Help");


//creating the submenu items here because we are gonna use these across the code
JRadioButton subMenuItem1 = new JRadioButton("Times New Roman");
JRadioButton subMenuItem2 = new JRadioButton("Arial");
JRadioButton subMenuItem3 = new JRadioButton("Serif");
JCheckBox subMenuItem4 = new JCheckBox("Bold");
JCheckBox subMenuItem5 = new JCheckBox("Italic");

//provide scrollable view of a component
JScrollPane scrollPane;

//creating notePadArea for notepad to input the text
JTextArea notePadArea;

public MyMenuFrame() {

//setting the border layout for JFrame
this.setLayout(new BorderLayout());

// create menu bar named menuBar

JMenuBar menuBar = new JMenuBar();

this.setJMenuBar(menuBar);//adding the menubar to JFrame

// create File menu
mnFile.setMnemonic(KeyEvent.VK_F);//Alt+F

menuBar.add(mnFile);//adding the menufile

// create Open menu item

JMenuItem mntmOpen = new JMenuItem("Open");//creating the Open menu

mntmOpen.setMnemonic(KeyEvent.VK_O);//Alt+O command

mntmOpen.setActionCommand("open");//when the command equals to 'open' then the corresponding action will be performed

mntmOpen.setAccelerator(KeyStroke.getKeyStroke('O', KeyEvent.CTRL_DOWN_MASK));//respond when user clicks Ctrl+O

mntmOpen.addActionListener(this);//adding actionLister to the Menu Option Open


// create Save menu item

JMenuItem mntmSave = new JMenuItem("Save");//creating the Save menu

mntmSave.setMnemonic(KeyEvent.VK_S);//Alt+S command

mntmSave.setActionCommand("save");//when the command equals to 'save' then the corresponding action will be performed

mntmSave.setAccelerator(KeyStroke.getKeyStroke('S', KeyEvent.CTRL_DOWN_MASK));//respond when user clicks Ctrl+S

mntmSave.addActionListener(this);//adding actionLister to the Menu Option Save

// create Exit menu item

JMenuItem mntmExit = new JMenuItem("Exit");//creating the Exit menu

mntmExit.setMnemonic(KeyEvent.VK_X);//Alt+X command

mntmExit.setActionCommand("exit");//when the command equals to 'exit' then the corresponding action will be performed

mntmExit.setAccelerator(KeyStroke.getKeyStroke('X', KeyEvent.CTRL_DOWN_MASK));//respond when user clicks Ctrl+X

mntmExit.addActionListener(this);//adding actionLister to the Menu Option Exit

// add open, save and exit menu to menu-bar

mnFile.add(mntmOpen);

mnFile.addSeparator();//adding separator between open and save

mnFile.add(mntmSave);

mnFile.addSeparator();//adding separator between save and exit

mnFile.add(mntmExit);

// create Edit menu

menuEdit.setMnemonic(KeyEvent.VK_E);//creating shortcut menu when user press Alt+E

menuBar.add(menuEdit);//adding the Edit to the menubar

JMenu submenu1 = new JMenu("Color");//creating the new menu which comes under Edit
submenu1.setMnemonic(KeyEvent.VK_C);//creating shortcut menu when user press Alt+C
JMenuItem menuItem0 = new JMenuItem("Change Color");//creating submenu item called change color
menuItem0.setAccelerator(KeyStroke.getKeyStroke('C', KeyEvent.CTRL_DOWN_MASK));//it responds when user click Ctrl+C
menuItem0.setActionCommand("color");//setting the command used to call the correcponding action when user click this
menuItem0.addActionListener(this);//adding actionlistener
submenu1.add(menuItem0);//adding this menu item to submenu
menuEdit.add(submenu1);//adding this submenu to editmenu
menuEdit.addSeparator();//creating separator between Color and Font

JMenu submenu = new JMenu("Font");//creating the new menu which comes under Edit
submenu.setMnemonic(KeyEvent.VK_F);//creating shortcut menu when user press Alt+F
subMenuItem1.setMnemonic(KeyEvent.VK_T);//creating shortcut menu when user press Alt+T for Times New Roman
subMenuItem1.setActionCommand("times_new_roman");//setting the command used to call the correcponding action when user click this
subMenuItem1.addActionListener(this);//adding actionlistener
submenu.add(subMenuItem1);//adding to the submenu


subMenuItem2.setMnemonic(KeyEvent.VK_A);//creating shortcut key Alt+A
subMenuItem2.setActionCommand("arial");//respond when the command equals to arial
subMenuItem2.addActionListener(this);//adding action listener
submenu.add(subMenuItem2);//adding it to the submenu

subMenuItem3.setMnemonic(KeyEvent.VK_S);
subMenuItem3.setActionCommand("serif");
subMenuItem3.addActionListener(this);
submenu.add(subMenuItem3);

submenu.addSeparator();

subMenuItem4.setMnemonic(KeyEvent.VK_B);
subMenuItem4.setActionCommand("bold");
subMenuItem4.addActionListener(this);
submenu.add(subMenuItem4);

subMenuItem5.setMnemonic(KeyEvent.VK_I);
subMenuItem5.setActionCommand("italic");
subMenuItem5.addActionListener(this);
submenu.add(subMenuItem5);

menuEdit.add(submenu);


// create Print menu


menuPrint.setMnemonic(KeyEvent.VK_P);

menuBar.add(menuPrint);

JMenuItem menuItemPrint = new JMenuItem("Send To Printer");

menuItemPrint.setAccelerator(KeyStroke.getKeyStroke('P', KeyEvent.CTRL_DOWN_MASK));

menuItemPrint.setActionCommand("print");

menuItemPrint.addActionListener(this);

menuPrint.add(menuItemPrint);

// create Help menu

menuHelp.setMnemonic(KeyEvent.VK_H);


menuBar.add(menuHelp);

JMenuItem menuItemHelp = new JMenuItem("About");

menuItemHelp.setAccelerator(KeyStroke.getKeyStroke('A', KeyEvent.CTRL_DOWN_MASK));

menuItemHelp.setActionCommand("about");
menuItemHelp.addActionListener(this);

JMenuItem menuItemVisitHomePage = new JMenuItem("Visit Home Page");

menuItemVisitHomePage.setAccelerator(KeyStroke.getKeyStroke('V', KeyEvent.CTRL_DOWN_MASK));

menuItemVisitHomePage.setActionCommand("visithomepage");
menuItemVisitHomePage.addActionListener(this);

menuHelp.add(menuItemHelp);

menuHelp.addSeparator();

menuHelp.add(menuItemVisitHomePage);

notePadArea = new JTextArea();

// set no word wrap

notePadArea.setWrapStyleWord(false);

// create scrollable pane

scrollPane = new JScrollPane(notePadArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS , JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

this.add(scrollPane,BorderLayout.CENTER);

}


@Override

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals("exit")) {

System.exit(0);

}else if (e.getActionCommand().equals("open")) {

JFileChooser file = new JFileChooser();

String fileName = "";//initial filename was empty

// show open file dialog

if (file.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {

fileName = file.getSelectedFile().getAbsolutePath();

} else {

return;

}

try(BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));) {

// load file content into text area

StringBuffer stringBuffer = new StringBuffer();//creating a string buffer for reading data from file

String lines = "";//for reading the lines from the selecting file

while((lines = bufferedReader.readLine() ) != null) {//it'll read untill the file ends

stringBuffer.append(lines).append("\n");//for every line read insert new line in stringBuffer

}

bufferedReader.close();//after reading of file done, the bufferedReader will be close

notePadArea.setText(stringBuffer.toString());//converting the read text to string and inserting this text into textArea

} catch (Exception error1) {//if any exception occures

System.out.println(error1.toString());//convert the expection into string and print it

}

} else if (e.getActionCommand().equals("save")) {//if the user click the save command then the file will gonna saved


JFileChooser file = new JFileChooser();//creating the file chooser

String fileName = "";//initial file name is empty

// show open file dialog

if (file.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {//if the user select file and clicks OK button

fileName = file.getSelectedFile().getAbsolutePath();

} else {//other wise will be closed
return;
}

try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(fileName));) {

// write editor's content to selected file.

bufferedWriter.write(notePadArea.getText());//get the text entered in textarea
bufferedWriter.flush();//clear the writer
} catch(Exception ex1) {}

} else if (e.getActionCommand().equals("color")) {

Color select_color = JColorChooser.showDialog(this, "Select a color", Color.RED);
notePadArea.setForeground(select_color);

} else if (e.getActionCommand().equals("times_new_roman")) {
if(subMenuItem1.isSelected())
notePadArea.setFont(new Font("Times New Roman", Font.PLAIN, 20));

} else if (e.getActionCommand().equals("arial")) {
if(subMenuItem2.isSelected())
notePadArea.setFont(new Font("Arial", Font.PLAIN, 20));

} else if (e.getActionCommand().equals("serif")) {
if(subMenuItem3.isSelected())
notePadArea.setFont(new Font("Serif", Font.PLAIN, 20));

} else if (e.getActionCommand().equals("bold")) {
if(subMenuItem4.isSelected()){
if(subMenuItem5.isSelected()){
notePadArea.setFont(new Font("Serif", Font.BOLD+Font.ITALIC, 12));
}else{
notePadArea.setFont(new Font("Serif", Font.BOLD, 12));
}
}else{
if(!subMenuItem5.isSelected())
notePadArea.setFont(new Font("Serif", Font.PLAIN, 12));
}

} else if (e.getActionCommand().equals("italic")) {

if(subMenuItem5.isSelected()){
if(subMenuItem4.isSelected()){
notePadArea.setFont(new Font("Serif", Font.BOLD+Font.ITALIC, 12));
}else{
notePadArea.setFont(new Font("Serif", Font.ITALIC, 12));
}
}else{
if(!subMenuItem4.isSelected())
notePadArea.setFont(new Font("Serif", Font.PLAIN, 12));
}

} else if (e.getActionCommand().equals("print")) {

int output = JOptionPane.showConfirmDialog(this, "Do you want to print the File","Confirmation", JOptionPane.YES_NO_OPTION);
if(output==0){
JOptionPane.showMessageDialog(this, "The file is successfully printed","Confirmation", JOptionPane.INFORMATION_MESSAGE);
}
} else if (e.getActionCommand().equals("changecolor")){
System.out.println("Color clicked");
}
else if (e.getActionCommand().equals("about")) {

JOptionPane.showMessageDialog(this, "This software is developed in 2019\nVersion is 1.0","About", JOptionPane.INFORMATION_MESSAGE);

} else if (e.getActionCommand().equals("visithomepage")) {

openWebpage("http://www.microsoft.com");

}

}

private void openWebpage (String urlString) {

try {

Desktop.getDesktop().browse(new URL(urlString).toURI());

}

catch (Exception e) {

e.printStackTrace();
}
}
}

import javax.swing.JFrame;
public class MyMenuFrameTest {
public static void main(String[] args) {
MyMenuFrame frame = new MyMenuFrame();
frame.setTitle("MyNotepad");
//for the title of the box
frame.setSize(600, 400);
//for the size of the box
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);
}
}

In: Computer Science

Python please Questions #6 and # 7 please A string is one of most powerful data...

Python please Questions #6 and # 7 please

A string is one of most powerful data types in programming. A string object is a sequence of characters and because it is a sequence, it is indexable, using index numbers starting with 0. Similar to a list object, a string object allows for the use of negative index with -1 representing the index of the last character in the sequence. Accessing a string object with an invalid index will result in IndexError exception.

In Python a string literal is defined to be a sequence of characters enclosed in single, double or triple quotes.

To define a string object or variable, we use one of the following:

  1. strObj = string_literal
  2. strObj = str(any object)
  3. strObj = str() or strObj = ‘’, strObj = “”, strObj = ‘’’’’’ , an empty string

A string object in immutable, meaning, it cannot be changed once it is defined.

The concatenation operator (+) is used to add two or more string objects (strObj1 + strObj2)

The repetition operator (*) is used to repeat the string object (n*strObj or strObj*n, where n is an integer)

The in and not in operators are used to test if one string object is contained in another string object.

Slice a string object using strObj[start:end], start is the index of the starting character and end-1 is the index last character.

The split method creates a list of the split string object.

lstObj = strObj.split(split-character)

space is the default split-character.

The strip method removes the leading and trailing character, the default is space.

strObj.strip(strip-character)

Variations: rstrip, lstrip (left and right strip methods to remove leading and trailing character, respectively)

Other commonly used string methods are

strObj.lower() changes all characters to lowercase

strObj.upper() changes all characters to uppercase

strObj.islower() tests if all characters are lowercase

strObj.isupper() tests if all characters are uppercase

strObj.replace(old, new) replaces old substring with new substring

strObj.find(substring) returns the lowest index of the substring if it is found in strObj

Activity

  1. Write a program to reverse a string object
  2. Write a program that will check if a string object is a palindrome, that is a word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run. Note: reverse(string) = string.
  3. Define a string object that will hold “department computer science:fayetteville state university:fayetteville, north carolina”
  4. Split the string object in (3) using the character “:” and assign to a list object
  5. Write a program that capitalize the first letter of every word in string object in (3)
  6. Write a program that insert the string objects “of” and “28301” to the new string object in (5)
  7. Write a program that will display the word, character, space counts in the file storytelling.txt.(The file is on Canvas in the Worksheets folder).

In: Computer Science

Write the RE for identifiers that can consist of any sequence of letters (l) or digit...

Write the RE for identifiers that can consist of any sequence of letters (l) or digit (d) or "_"
but the first char must be a letter and the last char cannot be a "_" (10)

In: Computer Science

Exercise 9 – Writing values from a list into a file Complete the function design for...

Exercise 9 – Writing values from a list into a file Complete the function design for the write_most_frequent() function, which takes 4 parameters, a string, a list of tuples, an integer, and another string: • The first string represents the name of the file to write to (with the append usage mode) • The list of tuples contains the information to write. Assume the list has already been sorted. • The integer represents the number of elements to read from the list and write to the file • The title should be written to the file before writing data from the list.

def test_write_most_frequent():
   print("testing write_most_frequent")
   list1 = [("a",27), ("bc",25), ("defg",21), ("hi",21), ("jk",18),
           ("l",17), ("m",16), ("nop", 15), ("qr", 14), ("s", 13),
           ("t",10), ("uv",9), ("x",5), ("yz",2)]
   write_most_frequent("test_output.txt", list1, 5, "Alphabet Statistics")
   # Should append to a file called test_output.txt the following:
   # Results for Alphabet Statistics:
   # a: 27
   # bc: 25
   # defg: 21
   # hi: 21
   # jk: 18

   write_most_frequent("test_output.txt", list1, 12, "Large Alphabet Statistics")
   # Should append to a file called test_output.txt the following:
   # Results for Large Alphabet Statistics:
   # a: 27
   # bc: 25
   # defg: 21
   # hi: 21
   # jk: 18
   # l: 17
   # m: 16
   # nop: 15
   # qr: 14
   # s: 13
   # t: 10
   # uv: 9

-------------------------------------
# (str, (list of tuple), int, str -> None)
# appends to the file named filename data from the first
# n elements found in the given list; assumes the list is sorted;
# the title given should be written on its own line first
def write_most_frequent(filename, list, n, title):
   print("Fix me")

In: Computer Science

You will create a program with 3 methods. For the previous homework with three problems, you...

You will create a program with 3 methods. For the previous homework with three problems, you will create a method for each problem.

In the main method, you will declare the three arrays and create the memory space for each of them. The first method will receive a one dimension array and then it will assign the values ( e.g., a[4] = 4*4*4*4;). The second method receives a 2 dimensional array and creates the calendar. The third method receives a two dimensional array and inverts row 1 in row.

Please note that you already have the bodies of the methods. You are only creating the methods and calling them in the main method.

You will also create methods printOneDimArray; printArrayCalendar; and printTwoDimArray to print each of the arrays.

Previous Homework Instructions

  1. Assigning values to an array. Write a pseudo and the java code that for the first 10 numbers, the calculated number is equal to that number multiplied by itself that number of times. The result is saved in an array in the number cell. Also, you shall print all the values of the array.
    Constraints: you must use a loop instruction to assign values to the array.

arrayNum [0] = 0
arrayNum [1] = 1
arrayNum [2] = 2*2
arrayNum [3] = 3*3*3
arrayNum [4] = 4*4*4*4

arrayNum [10] = 10*10*10…..*10

Hints: a) arrayNum [2] has a value of 4 and arrayNum [3] has a value of 27; b) use one loop to traverse the array and another to calculate the value based on the current index.

  1. Assigning values to a multidimensional array. Write a pseudocode and java code that puts the days of the month organized by weeks (as a calendar). Use a matrix of 5 x 7 (weeks of 7 days). Day 1 starts at [0][0]. See image in class ppt for arrays.

Hint: a) use one loop to manage the weeks and another to manage the days of the weeks

  1. Manipulating arrays. Given a two dimensional array, invert the first row into the second row.   Print the array once you have inverted the first row. Initialize your array as follows:
    int [ ] [ ] myBiDimArrayNum = {
                                                             { 1, 3, 5 ,7},
                                                             { 0, 0, 0, 0 }
                                                          };
    Note: you algorithm should modify the array as follow:
    myBiDimArrayNum   
       row 1: 1, 3, 5 ,7
       row 2: 7, 5, 3, 1

previous homework attached below

1) public class Test{

public static void main(String []args){
int[] arrayNum=new int[11];
for(int i=0;i<=10;i++)
{
arrayNum[i]=i;
for(int j=0;j<i-1;j++)
{
arrayNum[i]=arrayNum[i]*i;
}
}
System.out.println("Array is");
for(int i=0;i<=10;i++)
{
System.out.println("arrayNum["+i+"]="+arrayNum[i]);
}

}
}

2) import java.util.Scanner;
import java.util.Arrays;
  
public class MyClass
{

public static void main(String args[])
{
int [ ] [ ] matrix = new int [5][7];

Scanner sc = new Scanner(System.in);
int days=1;
System.out.println("Assigning Values");

for (int i = 0; i <5; i++)
{
for (int j = 0; j < 7; j++)
{
matrix[i][j] = days++;
if(days==32)
{
break;
}

}
//because day can be 31 only.
if(days==31)
{
break;
}
}

  
for (int i = 0; i < 5; i++)
{
// Loop through all elements of current row
for (int j = 0; j < 7; j++)
{
System.out.print(matrix[i][j] + " ");
}
System.out.println();
}
  
}
}

3)

import java.util.Scanner;
import java.util.Arrays;
  
public class MyClass
{

public static void main(String args[])
{
int [ ] [ ] myBiDimArrayNum = {
{ 1, 3, 5 ,7},
{ 0, 0, 0, 0 }
};

Scanner sc = new Scanner(System.in);
int days=1;
System.out.println("Manipulating Array");

for (int i = 0; i <2; i++)
{
//take this variable to copy elements from end of row first.
int last=3;
for (int j = 0; j < 4; j++)
{
//because indexing start from zero 1 will represent row second now we have to change its content.
if(i==1)
{
//As we have to manipulate the second from ending of row first we are using ***(i-1) and assign it to second row that is **(i).
myBiDimArrayNum[i][j]=myBiDimArrayNum[i-1][last];
last--;
}

}
}

  
for (int i = 0; i < 2; i++)
{
// Loop through all elements of current row
for (int j = 0; j < 4; j++)
{
System.out.print(myBiDimArrayNum[i][j] + " ");
}
System.out.println();
}
  
}
}

In: Computer Science

The top-left section of the spreadsheet is designed for summary statistics for one condition. You will...

The top-left section of the spreadsheet is designed for summary statistics for one condition. You will calculate average selling prices and the number of houses sold in each city (the condition).

In cell B2, insert the AVERAGEIF function to calculate the average Sold Price for houses in the city of Alpine. Use mixed references for the range; use a relative reference to cell A2. Copy the function and use the Paste Formulas option to paste the function in the range B3:B5 so that the bottom border in cell B5 is preserved.

In: Computer Science

C ++ code that accepts any measurement in meters entered by the user through the keyboard...

C ++ code that accepts any measurement in meters entered by the user through the keyboard and displays the equivalent measurement in feet on the console (1 Meters = 3.2808 Feet). Use proper variable names.

In: Computer Science

What are some deadlocks examples that are frequently observed on Windows and on Linux?

What are some deadlocks examples that are frequently observed on Windows and on Linux?

In: Computer Science

Quicksort - Divider and Conquer Illustrate the operation of PARTITION on the array: A = {9,...

Quicksort - Divider and Conquer

Illustrate the operation of PARTITION on the array:
A = {9, 19, 13, 5, 12, 8, 7, 4, 21, 6, 11}.
Let A[1] = 9 be the pivot value.

In: Computer Science

1 You're entering records into a database, and you realize you don't have the information for...

  • 1

You're entering records into a database, and you realize you don't have the information for one of the fields. What do you do?

Use letters in alphabetical order to select options

  1. A

In the Field Properties section, change the Required field to Blank so users can skip the field during data entry.

  1. B

Unless a field's set up to require an entry, you can skip the fields for which you don't have any data.

  1. C

In order for a user to leave a field blank, you'd have to set its data type to Optional so that data entry personnel can skip it.

  1. D

Access doesn't allow blank fields, so you have to wait until you have all the fields' data before you can enter that record.

2

Which data type would you use for a field that will contain phone numbers?

Use letters in alphabetical order to select options

  1. A

Number.

  1. B

Hyperlink.

  1. C

Short Text.

  1. D

AutoNumber.

3

On which Ribbon tab will you find tools for starting a new table?

Use letters in alphabetical order to select options

  1. A

The Database Tools tab contains the Create Table button.

  1. B

The Create tab contains the Table and Table Design buttons.

  1. C

The Design tab contains the Design Table button.

  1. D

The File tab contains the New Table command.

4

What are the benefits of using validation rules?

Use letters in alphabetical order to select options

  1. A

They reduce typos, create a consistent look for reports, and make searching easier.

  1. B

They make data entry go faster by inserting a value automatically into the field, and they make it easier to set up reports that must include a lot of information on a single sheet of paper.

  1. C

They eliminate duplicate entries in records that must remain unique, and they speed up the data entry process.

  1. D

They prevent duplicate values in more than one field in the table, which makes it easier for Access to sort your records.

5

How do you control the way Access stores and displays a date in a table field?

Use letters in alphabetical order to select options

  1. A

Type MMDDYYYY into the Validation Rule row under Field Properties.

  1. B

Use the Format setting under Field Properties, and choose a format from the drop-down menu.

  1. C

Type Short or Long, the two date format options, into the Format row under Field Properties.

  1. D

Type Short Date in the Field Size setting under Field Properties.

6

When you're ready to go back to work on a database you used earlier in the day, what's the quickest way to find and reopen it?

Use letters in alphabetical order to select options

  1. A

Click the File tab, and click the Open command to display your most recently used database files.

  1. B

Click the Home tab, click the View button's drop-down menu, and choose View Recent Files.

  1. C

Click the Open button on the Quick Access Toolbar.

  1. D

Click the File tab and see the file listed in the menu, or click Recent to display a list of recently used databases.

7

Which data types can you apply to the primary key in your Access tables?

Use letters in alphabetical order to select options

  1. A

Primary key fields can use AutoNumber or Text data types, but they can't use Memo data types.

  1. B

Any data type other than Memo is acceptable for a primary key.

  1. C

The default is AutoNumber, but any data type that allows a user to enter unique data into that field is acceptable.

  1. D

All primary keys use the AutoNumber data type because it's the only one that allows unique data entry.

8

How do you display your tables' fields so you can establish relationships between tables in your database?

Use letters in alphabetical order to select options

  1. A

On the Database Tools tab, click the Object Dependencies button to display a list of all the table fields in your database.

  1. B

On the Create tab, click the Relationships button. From there, you can select the tables in your database from the drop menu and view their fields.

  1. C

On the Database Tools tab, click the Relationships button, and use the resulting Show Table dialog box to display a field list box for each table in your database.

  1. D

Open all your tables in datasheet view, and use your mouse to drag the field names from one table to another.

9

What's the easiest way to rename a field?

Use letters in alphabetical order to select options

  1. A

Open the table in design view, click the current name in the Field Name column, and edit it there.

  1. B

The only field you can rename is the default ID field by adding text in front of the letters "ID" to customize the primary key.

  1. C

In the Table Tools tab, click the Insert Rows button, enter the desired field name into the new row, and then use the Delete Row button to remove the one with the incorrect name.

  1. D

You can't rename fields once you've created them. All you can do is delete them and create a new field with the name you wanted to use.

10

When you work with a form, as many as five arrow buttons may appear near the bottom left corner of your form. Which of these buttons can you always use to go to the last record in your table?

Use letters in alphabetical order to select options

  1. A

The second button, which looks like a left arrow.

  1. B

The fourth button, which looks like a right arrow pointing to a vertical line.

  1. C

The first button, which looks like a left arrow pointing at a line.

  1. D

The third button, which looks like a right arrow.

In: Computer Science

Make a C++ program that reads the age of a person, if the person is between...

Make a C++ program that reads the age of a person, if the person is between 12 and 17 years old, a message that says "Teenager!" otherwise print "Not a teenager."

In: Computer Science

this is my code I want the opposite i want to convert a postfix expression to...

this is my code I want the opposite i want to convert a postfix expression to infix expression

#include <iostream>

#include <string>

#define SIZE 50

using namespace std;

// structure to represent a stack

struct Stack {

  char s[SIZE];

  int top;

};

void push(Stack *st, char c) {

  st->top++;

  st->s[st->top] = c;

}

char pop(Stack *st) {

  char c = st->s[st->top];

  st->top--;

  //(A+B)*(C+D)

  return c;

}

/* function to check whether a character is an operator or not.

this function returns 1 if character is operator else returns 0 */

int isOperator(char c) {

  switch (c)

  {

  case '^':

  case '+':

  case '-':

  case '*':

  case '/':

  case '%':

  return 1;

  default:

  return 0;

  }

}

/* function to assign precedence to operator.

In this function we assume that higher integer value means higher precedence */

int precd(char c) {

  switch (c)

  {

  case '^':

  return 3;

  case '*':

  case '/':

  case '%':

  return 2;

  case '+':

  case '-':

  return 1;

  default:

  return 0;

  }

}

//function to convert infix expression to postfix expression

string infixToPostfix(Stack *st, string infix) {

  string postfix = "";

  for(int i=0; i<infix.length(); i++)

     {

     if(isOperator(infix[i])==1)

     {

  while(st->top!=-1 && precd(st->s[st->top]) >= precd(infix[i]))

  postfix += pop(st);

  push(st,infix[i]);

     }

     else if(infix[i] == '(')

  push(st,infix[i]);

  

     else if(infix[i] == ')')

     {

  while(st->top!=-1 && st->s[st->top] != '(')

  postfix += pop(st);

  pop(st);

     }

     else

  postfix += infix[i];

  

  }

  while(st->top != -1)

  postfix += pop(st);

return postfix;

}

int main() {

  Stack st;

  st.top = -1;

  string infix;

  cout << "Enter an infix expression: ";

  getline(cin, infix);

  cout << "Postfix expression is: " << infixToPostfix(&st, infix);

  

  return 0;

}

In: Computer Science

What is a reasonable web hosting configuration? Draw/picture a typical configuration. Give any two reasons why...

What is a reasonable web hosting configuration? Draw/picture a typical configuration. Give any two reasons why is it a reasonable configurations?

Scalable cloud-based hosting is reasonable.

What is web cache? How a web cache work? Give an example of how a web cache can assist a web portal (considering any busy website, explain how caching can improve its performance)

(IT/E-Portals Development)

In: Computer Science