Questions
Data Structure 17. Given: (e + f) / a – b * c Write out the...

Data Structure

17.

Given: (e + f) / a – b * c

Write out the postfix form

19. Make a prototype, including task, input and output, of compareLists that would take two lists of reference (ArrayList) and return a count of matching items (note, do NOT code the function)

20.Using the Stack operations, write a pseudocode routine, dupPos, that takes aStack for integers, checks to see if the top is positive. If positive, duplicate the top of the stack (i.e. pop a copy of that value onto the stack). If it is negative, pop it off.

21.Use the ListInterface operations only to create a makeEven routine in C++ that will take a list of integers (array or linked, your choice) as a reference. Use the list operations on the passed list to make all items that are odd into even values.

22.What is the main difference between an ADT List and the ADT Stack?

In: Computer Science

Show that Turing-decidable languages are closed under the following operations: union concatenation star Show that Turing-recognizable...

Show that Turing-decidable languages are closed under the following operations:

  • union

  • concatenation

  • star

Show that Turing-recognizable languages are closed under the following operations:

  • union

  • concatenation

  • star

Each answer needs only be a short informal description of a Turing Machine (but it must still be sufficiently precise so someone could reconstruct a formal machine if needed).

In: Computer Science

Given the following IP address of 212.134.99.112 with a subnet mask of 255.255.255.224 Class of the...

  1. Given the following IP address of 212.134.99.112 with a subnet mask of 255.255.255.224

  1. Class of the IP address:
  2. Net ID for this IP address:
  3. Total number of subnets:
  4. First address (subnet ID) and the Last address (broadcast address) that 21.134.99.112 belongs to:

In: Computer Science

Use only three context selectors SPACE, >, and +, add document level CSS code to the...

  1. Use only three context selectors SPACE, >, and +, add document level CSS code to the HTML file below to implement styles required in the body portion of the HTML file.

    <body>
    <p> Here should be yellow </p> <div>

    <p> Here should be cyan </p> <div>

    Content of this division should be brown

               <p> Some text </p>
           </div>
    

    <p> Here should be red </p> <p> Here should be green </p> <div>

    <p> Here should be brown </p> <div>

    <p> Here should be pink </p> </div>

          </div>
       </div>
    

    <p> Here should be blue </p> </body>

2) Use minimal number of selectors, otherwise 10 points deduction will be applied.

  1. 1) Only three context selectors specified above can be used. Using other

    selectors or other types of CSS code, i.e. inline CSS or external CSS, will

    cause 50 points deduction.

In: Computer Science

The command below produces a row vector of 100 random values uniformly distributed between -10 and...

The command below produces a row vector of 100 random values uniformly distributed between -10 and +10.


r = 10.*rand(1,100)-10;

r = 20.*rand(1,100)-10;

r = -10.*rand(1,100)+10;

r = 10.*rand(1,100)-20;

In: Computer Science

Suppose you are given a list of n integers, each of size at most 100n. How...

Suppose you are given a list of n integers, each of size at most 100n. How many operations would it take you to do the following tasks (in answering these questions, we are interested primarily in whether it will take logn, sqrt(n), n, n^2, n^3, 2^n, ... steps. In other words, ignore multiplicative constants.)

1. Determine the longest sequence of consecutive integers belonging to the list.

2. Determine the number of primes in the list.

3. Determine whether there are three integers x, y and z from the list so that x + y = z.

4. Determine whether there are three integers x, y, and z from the list so that x^2 + y^2 = z^2.

In: Computer Science

Plot a dot matric using the sliding window 1 nucleotides long and setting up a stringency...

Plot a dot matric using the sliding window 1 nucleotides long and setting up a stringency threshold of 1 out 1 matches for putting a dot in the relevant element on the dot matrix. Draw a line on the dot matrix and write down the corresponding alignment between these two sequences.

AACTAGCCCCATGCAAGCATT

ACTAGCGCGCCTCATGCAGCATT

In: Computer Science

Case: A national football association needs to design a database to store information about all the...

Case:
A national football association needs to design a database to store information about all the players (identified by pid, with DOB, position and salary as attributes) registered under it, all the football clubs (identified by name, with city and asset as attributes) in the nation, and the stakeholders of each club (with name, age and percentage of holdings). Each player plays for one club, and each club has a captain player. Each stakeholder can only hold the shares of one club, and can be identified by name, given that his club is known.
Tasks:
1. Draw an ER diagram that captures this information.
2. Write SQL statements to create the corresponding relations and capture as many of the constraints as possible.
For any additional and reasonable assumptions made, please state clearly.

In: Computer Science

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and...

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program:

Min miles: -10
Max miles: 40

#include <iostream>
using namespace std;

int main() {
const int NUM_ROWS = 2;
const int NUM_COLS = 2;
int milesTracker[NUM_ROWS][NUM_COLS];
int i;
int j;
int maxMiles = -99; // Assign with first element in milesTracker before loop
int minMiles = -99; // Assign with first element in milesTracker before loop
int value;

for (i = 0; i < NUM_ROWS; i++){
for (j = 0; j < NUM_COLS; j++){
cin >> value;
milesTracker[i][j] = value;
}
}

/* Your solution goes here */

cout << "Min miles: " << minMiles << endl;
cout << "Max miles: " << maxMiles << endl;

return 0;
}

In: Computer Science

Write a C++ program that asks for the name and age of three people.   The program...

Write a C++ program that asks for the name and age of three people.   The program should then print out the name and age of each person on a separate line from youngest to oldest.

Hint: Start with a program that just asks for the names and ages then prints them out in the same order they are entered. Then modify the program so it prints out the list of names in every possible order.    Note that one of these will be the correct result. Then add conditions to each set of results so that only one set of results is true.

For example; part of my program will print:

name2
name1 

name3

Therefore the condition for this output would be:  (age2 < age1) && (age2 < age3) && (age1 < age3)

You can assume that all three ages will be different but consider what your program would do if two or more ages were the same. (If your program is written correctly - it should not matter)

Use if, else if and else statements in order to minimize the total number of comparisons. (See Rubric for how you will be graded on use of conditionals)

HINT: Plan out you approach ahead of time. Use pseudocode or flow chart if that helps.

Example Output:

Peter   2
Paul    20
Mary    54

In: Computer Science

4. Consider the following two alternative ER designs: • a ternary relationship set R that relates...

4. Consider the following two alternative ER designs:

• a ternary relationship set R that relates entity sets A, B, and C.

• a design in which R is replaced by an entity set E with E related to A, B, and C by 3 binary relationship sets RA, RB and RC , respectively.

Explain why, as stated, these two may not be equivalent. Then explain what could be done to make them equivalent by fixing each of RA, RB and RC , to be 1-1. m-m, 1-m, or m-1.

In: Computer Science

IN PYTHON Complete the following tasks, either in a file or directly in the Python shell....

IN PYTHON

Complete the following tasks, either in a file or directly in the Python shell.

  1. Using the string class .count() method, display the number of occurrences of the character 's' in the string "mississippi".

  1. Replace all occurrences of the substring 'iss' with 'ox' in the string "mississippi".

  1. Find the index of the first occurrence of 'p' in the string "mississippi".

  1. Determine what the following Python function does and describe it to one of your Lab TAs :

def foo(istring):

    p = '0123456789'

    os = ''

    for iterator in istring:

        if iterator not in p:

            os += iterator

    return os

In: Computer Science

I need this Java code translated into C Code. Thank you. //Logical is the main public...

I need this Java code translated into C Code. Thank you.

//Logical is the main public class

public class Logical {
public static void main(String args[]) {
char [][] table= {{'F','F','F'},{'F','F','T'},{'F','T','F'},{'F','T','T'},{'T','F','F'},{'T','F','T'},{'T','T','F'},{'T','T','T'}};

// table contains total combinations of p,q,& r
int totalTrue, totalFalse, proposition;
  
//proposition 1:

proposition=1;
start(proposition);
totalTrue=0;
totalFalse=0;
for(int i=0;i<8;i++)
{
  
{
char o= conjuctive(implecation(negation(table[i][0]),table[i][1]),implecation(table[i][2],table[i][0]));
System.out.println(" "+table[i][0]+" "+table[i][1]+" "+table[i][2]+" "+o);
if(o=='T')
totalTrue++;
else
totalFalse++;
  
}
}
finalOutput(totalTrue,totalFalse,proposition);
System.out.println(" ");
System.out.println(" ");
  

//proposition 2:
proposition=2;
start(proposition);
totalTrue=0;
totalFalse=0;
for(int i=0;i<8;i++)
{
  
{
char o= conjuctive(disjunctive(table[i][0],negation(table[i][1])),disjunctive(table[i][2],negation(implecation(table[i][0],table[i][1]))));
System.out.println(" "+table[i][0]+" "+table[i][1]+" "+table[i][2]+" "+o);
if(o=='T')
totalTrue++;
else
totalFalse++;
  
}
}
finalOutput(totalTrue,totalFalse,proposition);
System.out.println(" ");
System.out.println(" ");
  

//Proposition 3
proposition=3;
start(proposition);
totalTrue=0;
totalFalse=0;
for(int i=0;i<8;i++)
{
  
{
char o= implecation(table[i][0],implecation(negation(conjuctive(table[i][0],negation(table[i][1]))),conjuctive(table[i][0],table[i][1])));
System.out.println(" "+table[i][0]+" "+table[i][1]+" "+table[i][2]+" "+o);
if(o=='T')
totalTrue++;
else
totalFalse++;
  
}
}
finalOutput(totalTrue,totalFalse,proposition);
System.out.println(" ");
System.out.println(" ");
  

//Proposition 4
proposition=4;
start(proposition);
totalTrue=0;
totalFalse=0;
for(int i=0;i<8;i++)
{
  
{
char o= conjuctive(conjuctive(table[i][0],implecation(table[i][0],table[i][1])),negation(table[i][1]));
System.out.println(" "+table[i][0]+" "+table[i][1]+" "+table[i][2]+" "+o);
if(o=='T')
totalTrue++;
else
totalFalse++;
  
}
}
finalOutput(totalTrue,totalFalse,proposition);
  
/* //Proposition 0
proposition=0;
start(0);
totalTrue=0;
totalFalse=0;
for(int i=0;i<8;i++)
{
  
{
char o= conjuctive(table[i][0],conjuctive(table[i][1],negation(table[i][2])));
System.out.println(" "+table[i][0]+" "+table[i][1]+" "+table[i][2]+" "+o);
if(o=='T')
totalTrue++;
else
totalFalse++;
  
}
}
finalOutput(totalTrue,totalFalse,proposition);*/
  
}

//method to check contradiction & tautology
static public void finalOutput(int totalTrue,int totalFalse,int proposition)
{
System.out.println(" "+totalTrue+" combination result in Proposition " +proposition+" being T");
System.out.println(" "+totalFalse+" combination result in Proposition "+proposition+ " being F");
if(totalTrue==8)
System.out.println(" Proposition "+ proposition+ " is a tautology");
else if(totalFalse==8)
System.out.println(" Proposition " + proposition+" is a contradiction");
else
System.out.println(" Proposition "+proposition +" is neither a tautology nor a contradiction");
}
static public void start(int i)
{
System.out.println(" "+"p"+" "+"q"+" "+"r"+" "+"Proposition "+ i);
System.out.println("----------------------------------------------------");
}
// negation method
static public char negation(char x)
{
if(x=='T')
return 'F';
else
return 'T';
}
// disjuctive method
static public char disjunctive(char x, char y)
{
if(x=='T' || y=='T')
return 'T';
else
return 'F';
}
// conjuctive method
static public char conjuctive(char x, char y)
{
if(x=='F' || y=='F')
return 'F';
else
return 'T';
}
// implecation method
static public char implecation(char x,char y)
{
if((x=='T' && y=='T') ||(x=='F' && y=='F') || (x=='F' && y=='T'))
return 'T';
else
return 'F';
}
}

In: Computer Science

Create a two-part form that calculates weekly income for Happy Diner's waitress Tammy, based on her...

Create a two-part form that calculates weekly income for Happy Diner's waitress Tammy, based on her regular hours, overtime pay, and tips. She makes $10 an hour, if she works 40 hours a week, or less. Her overtime pay is $15 an hour. If Tammy worked over 40 hours, she is earning her overtime wages. Happy customers give her tips as well.

Use an HTML document named tipsYourlastname.html as a Web form with two text boxes — one for the number of hours worked and one for the tips. Use a PHP document named tipsyourlastname.php as the form handler. Output the total amount earned to the screen in some nice organized manner. Please comment your code appropriately and test your program with various input to ensure it operates correctly. Check your math as well.

Please remember that program has to work to get credit.  This is a very small program, but you need to plan ahead and give yourself enough time for testing and debugging. Write a small piece of code at a time and test it before you add more code. Work incrementally.

In: Computer Science

" line 48"     return delta.days     ^ SyntaxError: 'return' outside function import datetime def nowDate():...

" line 48"
    return delta.days
    ^
SyntaxError: 'return' outside function

import datetime


def nowDate():
    current_time = datetime.datetime.now()
    new_time = datetime.datetime(
        current_time.year,
        current_time.month,
        current_time.day,
        0,
        0,
        0,
        )
    return new_time


def plusOneDay(daytime):
    tomorrow = daytime + datetime.timedelta(days=1)
    return tomorrow


def nDaystoHoliday():
    NJCU_holidays = [
        (datetime.date(2019, 1, 1), "New Year's Day"),
        (datetime.date(2019, 1, 21), 'Martin Luther King, Jr. Day'),
        (datetime.date(2019, 2, 19), "President's Day"),
        (datetime.date(2019, 4, 19), 'Good Friday'),
        (datetime.date(2019, 5, 27), 'Memorial Day'),
        (datetime.date(2019, 7, 4), 'Independence Day'),
        (datetime.date(2019, 9, 2), 'Labor Day'),
        (datetime.date(2019, 10, 14), 'Columbus Day'),
        (datetime.date(2019, 11, 11), "Veteran's Day"),
        (datetime.date(2019, 11, 28), 'Thanksgiving'),
        (datetime.date(2019, 12, 25), 'Christmas Day'),
        ]


now = datetime.datetime.now().date()
print (now)
date = NJCU_holidays[0][0]
print (date)
for i in range(1, len(NJCU_holidays)):
    holiday = NJCU_holidays[i][0]
    delta = holiday - now
    if(delta.days > 0):
      return delta.days

time = nowDate()
plusOneDay(time)
nDaystoHoliday()

In: Computer Science