Questions
Prove or disprove with a counterexample the next claims: (a) The complement of a decidable language...

Prove or disprove with a counterexample the next claims:

(a) The complement of a decidable language is decidable.

(b) The Kleene star of a Turing-recognizable language is Turing-recognizable.

In: Computer Science

A)Write a C++ program using a while loop for Programming Exercise 5.1 on p. 193. Turn...

A)Write a C++ program using a while loop for Programming Exercise 5.1 on p. 193.

Turn in a printout of the program and a printout of the results.

Test the program for the two test cases in the book along with a third test case that includes 10 valid numbers (including some negative and some positive).

In: Computer Science

Java Write a class called Car that contains instance data that represents the make, model, and...

Java

Write a class called Car that contains instance data that represents the make, model, and year of the car.

Define the Car constructor to initialize these values

Include getter and setter methods for all instance data and a toString method that returns a one-line description of the car.

Add a method called isAntique that returns a boolean indicating if the car is an antique (if it is more than 45 years old).

Create a driver class called CarTest, whose main method instantiates and updates several Car objects

Must have two constructors, one accepts nothing and another overloaded constructor that accepts parameters.

Must have accessor and mutator methods for each instance variable, and the toString method

Must test ALL (the two constructors, the accessors, and mutators for each variable and the other methods if there are any) methods explicitly in the driver class’s main method with at least two objects.

Addon:

Create an array of five objects of the class you have created. Use a for loop to display the five objects first. Then test all methods using the objects in the array and finally print out each object using a for loop again.

In: Computer Science

Write a Java program to convert decimal (integer) numbers into their octal number (integer) equivalents. The...

Write a Java program to convert decimal (integer) numbers into their octal number (integer) equivalents. The input to the program will be a single non-negative integer number. If the number is less than or equal to 2097151, convert the number to its octal equivalent.

If the number is larger than 2097151, output the phrase “UNABLE TO CONVERT” and quit the program.

The output of your program will always be a 7-digit octal number with no spaces between any of the digits. Some of the leading digits may be 0.

Use a while loop to solve the problem. Do not use strings.

Sample Program Run
Please enter a number between 0 and 2097151 to convert: 160000
Your integer number 160000 is 0470400 in octal.

Please enter a number between 0 and 2097151 to convert: 5000000
UNABLE TO CONVERT

In: Computer Science

I need to answer the the following questions in Javascript; ------------------------------------------------------------------------------------------------------------------------ 3 Buttons to display “Lion”,...

I need to answer the the following questions in Javascript;

------------------------------------------------------------------------------------------------------------------------

3 Buttons to display “Lion”, “Tiger” and “Leopard” in a line and display textfield on next line

When“Cat” button is clicked the following 3 things will perform

Display text field “User clicks Lion”;

Under the text field display a message “Lion is clicked”;

Under the message, a photo of a lion is displayed. other buttons will work in a similar logic.

------------------------------------------------------------------------------------------------------------------------

Display the pictures of following “Lion”, “Tiger” and “Leopard”.

When users click on the “Lion” pic., alert window displays warning “Please do not click me, click the Leopard”.

When users click on the “Tiger” pic, alert window displays warning “Please do not click me, click the Leopard”

When users click on the “Leopard” pic, the leopard will jump over the Lion and Tiger, meaning that in the beginning it shows Lion Tiger Leopard, when users click the Leopard then it becomes Leopard Lion Tiger, and users click the leopard again then it becomes Lion Tiger Leopard, etc.

-----------------------------------------------------------------------------------------------------------------------

In: Computer Science

In Java or C++, implement a stack and a queue using a linkedlist data structure.  You may...

In Java or C++, implement a stack and a queue using a linkedlist data structure.  You may not use any standard Java or C++ libraries.

Assume your data structure only allows Strings. Implement the following operations for the data structure:

Queue: enqueue, dequeue, create, isEmpty (10 points)

Stack: push, pop, create, isEmpty (10 points)

Here is a link to get started on transferring from Java to C++ http://www.horstmann.com/ccj2/ccjapp3.html (Links to an external site.)

Upload a zip file with one implementation for your Stack and one for your Queue, along with any classes required to implement your linkedlist (i.e. nodes for linkedlist). In each file include a test method which shows how you've tested each operation.

In: Computer Science

All Hail Modulus Agustus! The modulus operator is used all the time. Realize that if you...

All Hail Modulus Agustus! The modulus operator is used all the time. Realize that if you “mod” any number by a number “n”, you’ll get back a number between 0 and n-1. For example, “modding” any number by 20 will always give you a number between 0-19. Your job is to design (pseudocode) and implement (source code) a program to sum the total of all digits in an input integer number between 0 and 1000, inclusive. Notice that you need to extract individual digits from the input number using the remainder (modulus) and division mathematical operators. For example, if the input number is 123, the sum of its digits is 6. Document your code and properly label the input prompts and the outputs as shown below. PLEASE DO IN JAVA

In: Computer Science

Case Study 3.2: AT&T The case of the BTC and its successor the American Telegraph and...

Case Study 3.2: AT&T The case of the BTC and its successor the American Telegraph and Telephone Company (AT&T) illustrates the business and policy issues associated with telephony service provision. Bell’s contributions as discussed in the Historical Note included perfecting the technologies necessary for transmission of voice using electrical wires. However, these by themselves were not enough to ensure the success of telephony service provision. Bell also created a company which in time would provide a universal telephony service to almost the entire North American market. The BTC (and its successor, AT&T) was greatly successful and grew to become one of the most valuable companies on the New York Stock Exchange. The success of the BTC was based initially on its utilization of Bell’s patented technology, licensing fees and ensuring competitors remained at a disadvantage. In the process BTC successfully defended its patents in courts over a period of some 20 years [1]. As it grew, BTC’s cost advantage allowed it to outperform and acquire competitors one after another: eventually becoming almost the sole provider of telephony services in the United States. Telegraphy and telephony were nascent industries: BTC established an R&D entity, and equipment manufacturing subsidiaries to provide it with the necessary technologies and devices as well as leadership in the field. In particular, Bell Laboratories – the research arm of the company – was the place which attracted many of the brightest mathematicians and scientists of the day. These researchers discovered and formulated principles not only associated with telecommunications but also many other fields as diverse as astronomy and quantum physics. In time Bell Laboratories became a world leading research institute and home to seven Nobel Prize laureates as well many other prestigious award winners. By any measure BTC’s technological endeavor was a great success. BTC’s business dynamics were characterized by the high infrastructure roll-out cost, and network effects. It was soon realized that no market could afford to have more than one operator as it was inefficient to duplicate wiring, and difficult to connect circuits between two operators. This led to the establishment of monopoly operators in different geographic regions, who were then acquired one after another by BTC, resulting in a near-monopoly operation in North America. Indeed, a theory was developed by AT&T president Theodore Vail in 1907, that the telephone, ‘by nature of its technology, would operate most efficiently as a monopoly providing universal service’ [10]. This monopoly control of the market was in conflict with anti-trust laws of the United States, and therefore BTC had to negotiate with the US government to allow it to run a monopoly business despite existing strong anti-trust laws. Over the years several anti-trust suits were launched but BTC continued to operate successfully for over 100 years. Despite all its advantages, BTC–AT&T fell into decline in the mid-1980s and was finally acquired by competitors, a fall which can be attributed to all three technological, business and policy factors. First, on the policy side, monopoly operation and lack of competition may have had a role in AT&T’s reputation for inadequate customer service. In 1974 another anti-trust suit was launched by the US government which resulted in a settlement which broke the monopoly operation that BTC had enjoyed. The company was divided into seven regional telephone operators known as Baby Bells. An eighth company connected these regional companies as a long-distance operator under the name AT&T. While BTC–AT&T had remained successful from the technological and business viewpoints, it had failed to stay with the policy shift and adjust accordingly. AT&T continued to operate profitably as a long-distance operator, carrying calls between regional Baby Bell telephone companies, and later as a mobile telephone operator. However, technological developments in whose development AT&T had played a prominent role led to its own demise. Bell Laboratories had been one of the major contributors to the development of optical fibre systems. These cables have very large capacities and can carry a very large number of simultaneous telephone calls. With the deployment of optical fibre cables in place of copper cables, and the deregulation of operator business, the cost of long-distance telephony dropped, and AT&T's business as a long-distance operator suffered. Mobile telephony was the other technological development which Bell Laboratories had pioneered. The growth of mobile operators and the competitive pressures on AT&T mobile division, in addition to its dubious strategic moves into content provision, finally led to high debt burdens and eventual fall. In effect, the technological break-throughs pioneered by AT&T had been used by its competitors in a more effective way. The ‘AT&T’ brand however was still very valuable and the acquiring companies adopted the name. The policy–business–technology developments of the last decades in the 20th century transformed the industry landscape and led to emergence of new companies. It also signaled the end of arguably the most iconic telecommunications company. Many telephone operators went through the same experience as AT&T. The majority were government-owned, and many have stayed afloat after deregulation. The emergence of mobile and broadband telecommunications has created new revenue streams as the case of Australian operator Telstra demonstrated. Nevertheless, the dynamics of technology, business and policy have been in play in every market, and have been instrumental in the success or failure of operator companies.

Case Study Questions: How did AT&T manage the technology–business–policy framework?

Case Study Question: Why was AT&T broken up?

In: Computer Science

risks involved with using the protected member access specifier instead of the private member access specifier?

risks involved with using the protected member access specifier instead of the private member access specifier?

In: Computer Science

define the following key terms . 1. Institute of Electrical and Electronics Engineers (IEEE) 2. Bandwidth...

define the following key terms

. 1. Institute of Electrical and Electronics Engineers (IEEE) 2. Bandwidth 3. Throughput 4. Latency 5. Radio frequency interference (RFI) 6. Physical media 7. Network Interface Card (NIC) 8. Half-duplex 9. Full-duplex 10. Carrier Sense Multiple Access / Collision Detection (CSMA/CD)

In: Computer Science

What is the purpose of the default gateway IP address?

What is the purpose of the default gateway IP address?

In: Computer Science

R Language library(tidyverse) data(diamonds) (a) How many diamonds have a `Very Good` cut or better?              ...

R Language

library(tidyverse)

data(diamonds)

(a) How many diamonds have a `Very Good` cut or better?

              - Note that cut is an *ordered factor* so the levels are in order.

(b) Which diamond has the highest price per carat (ppc = price / carat)? What is the value?

(c) Find the 95th percentile for diamond price.

               - Try the `quantile()` function.

(d) What proportion of the diamonds with a price above the 95th percentile and have the color `D` or `J`?

(e) What proportion of diamonds with a clarity of VS2 have a Fair cut and a table below 56.1?

(f) What is the average price per carat (ppc=price / carat) for each cut?

In: Computer Science

--Creating Package Table DROP TABLE Package_Dimensions; DROP TABLE Package_Statuses; DROP TABLE PACKAGES; DROP TABLE Status_Codes; DROP...

--Creating Package Table

DROP TABLE Package_Dimensions;

DROP TABLE Package_Statuses;

DROP TABLE PACKAGES;

DROP TABLE Status_Codes;

DROP TABLE Exception_Codes;

DROP TABLE Allowable_Limits;

DROP TABLE Limit_Codes;

CREATE TABLE Packages (Package_Id int PRIMARY KEY,Package_Number int);

--Creating Package Dimensions Table:

CREATE TABLE Package_Dimensions (Dimension_Id int Primary Key, Package_Id dec (5,2),Height dec (5,2),Width dec (5,2),Weight dec (5,2),Length dec (5,2));

--Creating Package Statuses Table

CREATE TABLE Package_Statuses (Package_Status_Id int Primary Key, Status_Id int, Package_Id int, Status_Code int, Status_Date date, Exception_Code int);

--Creating Status Codes and Exception Codes Table:

CREATE TABLE Status_Codes ( Status_Code int Primary Key,Description varchar(100));

CREATE TABLE Exception_Codes (Exception_Code int Primary Key,Description varchar(100));

--Creating Allowable Limts and Limt Codes Table:

CREATE TABLE Allowable_Limits (Limit_Id int Primary Key, Limit_Code int, Date_Active date, Date_Inactive date, Limit_Value int);

CREATE TABLE Limit_Codes (Limit_Code int Primary Key,Description varchar(100));

--Adding Foreign Keys to Tables By Referring Main Tables:

ALTER TABLE Package_Dimensions ADD FOREIGN KEY (Package_Id) REFERENCES Packages (Package_Id);

ALTER TABLE Package_Statuses ADD FOREIGN KEY (Package_Id) REFERENCES Packages (Package_Id);

ALTER TABLE Package_Statuses ADD FOREIGN KEY (Status_Code) REFERENCES Status_Codes (Status_Code);

ALTER TABLE Package_Statuses ADD FOREIGN KEY (Exception_Code) REFERENCES Exception_Codes (Exception_Code);

ALTER TABLE Allowable_Limits ADD FOREIGN KEY(Limit_Code) REFERENCES Limit_Codes (Limit_Code);

--Inserting Values Into Tables :

INSERT INTO Status_Codes VALUES (4,'The package Status is Active');

INSERT INTO Exception_Codes VALUES (6,'The package Has Some Errors');

INSERT INTO Limit_Codes VALUES (8,'This Limit Code has some Features');

INSERT INTO Allowable_Limits VALUES (1,8,to_date('2019/09/04','YYYY/MM/DD'),to_Date('2019/09/08','YYYY/MM/DD'),10);

INSERT INTO Packages values (100,1010);

INSERT INTO Packages values (101,1001);

INSERT INTO Package_Dimensions VALUES (6,100,10,20,800,40);

INSERT INTO Package_Statuses VALUES (4,101,100,4,to_Date('2019/09/04','YYYY/MM/DD'),6);

--Displaying Data In the Tables:

SELECT * FROM Packages;

SELECT * FROM Allowable_Limits;

  1. Insert at least five rows in each table
  2. Alter at least one table to include a constraint on a column (e.g. BETWEEN 1 and 12, IN ('GA', 'SC', "TN'))
  3. Run at least two queries to demonstrate that the constraint was defined properly.
  4. Run updates on at least two tables
  5. Use at least two queries to demonstrate that referential integrity is set up correctly for your tables.

Written in Oracle SQL

In: Computer Science

Without dramatically changing the code please add a basic "linked list in ascending order" (option 7)....

Without dramatically changing the code please add a basic "linked list in ascending order" (option 7). Please leave comments within the code so I can understand what is being done, thank you.

import java.util.Scanner;
/* Class Node */

class Node
{
protected int data;
protected Node link;

public Node()
{
link = null;
data = 0;
}
public Node(int d,Node n)
{
data = d;
link = n;
}
public void setLink(Node n)
{
link = n;
}
public void setData(int d)
{
data = d;
}
public Node getLink()
{
return link;
}
public int getData()
{
return data;
}
}
class linkedList
{
protected Node start;
protected Node end ;
public int size ;

public linkedList()
{
start = null;
end = null;
size = 0;
}
public boolean isEmpty()
{
return start == null;
}
public int getSize()
{
   return size;
}
public void insertAtStart(int val)
{
Node nptr = new Node(val, null);
size++ ;
if(start == null)
{
start = nptr;
end = start;
}
else
{
nptr.setLink(start);
start = nptr;
}
}
public void insertAtEnd(int val)
{
Node nptr = new Node(val,null);
size++ ;
if(start == null)
{
   start = nptr;
end = start;
}
else
{
end.setLink(nptr);
end = nptr;
}
}
public void insertAtPos(int val , int pos)
{
Node nptr = new Node(val, null);
Node ptr = start;
pos = pos - 1 ;
for (int i = 1; i < size; i++)
{
   if (i == pos)
{
Node tmp = ptr.getLink() ;
ptr.setLink(nptr);
nptr.setLink(tmp);
break;
}


ptr = ptr.getLink();
}
size++ ;
}
public void deleteAtPos(int pos)
{   
if (pos == 1)
{
start = start.getLink();
size--;
return ;
}
if (pos == size)
{
Node s = start;
Node t = start;
while (s != end)
{
t = s;
s = s.getLink();
}
end = t;
end.setLink(null);
size --;
return;
}
Node ptr = start;
pos = pos - 1 ;
for (int i = 1; i < size - 1; i++)
{
if (i == pos)
{
Node tmp = ptr.getLink();
tmp = tmp.getLink();
ptr.setLink(tmp);
break;
}
ptr = ptr.getLink();
}
size-- ;
}
public void display()
   {
System.out.print("\nSingly Linked List = ");
if (size == 0)
{
System.out.print("empty\n");
return;
}
if (start.getLink() == null)
{
System.out.println(start.getData() );
return;
}
Node ptr = start;
System.out.print(start.getData()+ "->");
ptr = start.getLink();
while (ptr.getLink() != null)
{
System.out.print(ptr.getData()+ "->");
ptr = ptr.getLink();

}

System.out.print(ptr.getData()+ "\n");

}

}

import java.util.Scanner;
/* Class SinglyLinkedList */

public class SinglyLinkedList

{

public static void main(String[] args)

{
Scanner scan = new Scanner(System.in);

/* Creating object of class linkedList */

linkedList list = new linkedList();

System.out.println("Singly Linked List Test\n");

char ch;

/* Perform list operations */

do

{

System.out.println("\nSingly Linked List Operations\n");

System.out.println("1. insert at begining");

System.out.println("2. insert at end");

System.out.println("3. insert at position");

System.out.println("4. delete at position");

System.out.println("5. check empty");

System.out.println("6. get size");

int choice = scan.nextInt();

switch (choice)

{

case 1 :

System.out.println("Enter integer element to insert");

list.insertAtStart( scan.nextInt() );

break;

case 2 :

System.out.println("Enter integer element to insert");

list.insertAtEnd( scan.nextInt() );

break;

case 3 :

System.out.println("Enter integer element to insert");

int num = scan.nextInt() ;

System.out.println("Enter position");

int pos = scan.nextInt() ;

if (pos <= 1 || pos > list.getSize() )

System.out.println("Invalid position\n");

else

list.insertAtPos(num, pos);

break;

case 4 :

System.out.println("Enter position");

int p = scan.nextInt() ;

if (p < 1 || p > list.getSize() )

System.out.println("Invalid position\n");

else

list.deleteAtPos(p);

break;

case 5 :

System.out.println("Empty status = "+ list.isEmpty());

break;

case 6 :

System.out.println("Size = "+ list.getSize() +" \n");

break;

   default :

System.out.println("Wrong Entry \n ");

break;

}

/* Display List */

list.display();

System.out.println("\nDo you want to continue (Type y or n) \n");

ch = scan.next().charAt(0);

} while (ch == 'Y'|| ch == 'y');

}

}

In: Computer Science

Database Question Create two entities for Online Journalists business. Each entity must have 5 attributes and...

Database Question

Create two entities for Online Journalists business.

Each entity must have 5 attributes and explain the type of each attribute.

In: Computer Science