Write a program that asks the user to enter a number. Display
the following pattern by writing lines of asterisks.
The first line will have one asterisk, the next two, and so on,
with each line having one more asterisk than the previous
line,
up to the number entered by the user.For example, if the user
enters 5, the output would be:
*
* *
* * *
* * * *
* * * * *
short codes please
In: Computer Science
For each of the following grammars, first classify the grammar as Regular, Linear, Context-Free or Context-Sensitive, and then precisely describe the language generated by the grammar.
R → aR | bR | є
A → aaaA | є
B → Bbb | b
R → aRb | bRa | RR | bR | є
(5) S → a S b | C
Set of terminals here is T = {a, b, c}
C → cc C | є
In: Computer Science
Visual Basics 2015 The local smoothie store, Smoothie Queen has hired you to develop a program that will make it easier for their sales associates to compute a customer's bill. You are to write a program that will allow the cashier to enter in customer information, smoothie information and display the total amount due. Here are the pertinent details: CALCULATIONS: 1. COST OF A SMOOTHIE: The actual cost of the smoothie is based on the smoothie size and the smoothie style. See the table below for price information. Internally you can handle this in one of two ways – you can either store this in a two-dimensional array/table or you can use an array of structures with two fields like you did in the state/abbreviation program. Small Medium Large King Regular 5.99 6.99 7.99 8.99 Organic 6.99 7.99 8.99 9.99 There are two different ways to approach the needed programming for the smoothie prices. You can use either of these – whichever one makes the most sense to you. My personal approach would be the first one (two dimensional arrays) because the data lays out like an Excel spreadsheet so it’s easy to think in rows and columns. But many people would also take the second approach (array of structures): A. Two-Dimensional Array Approach: If you are going to use a 2 dimensional array/table, you could declare it using something like this at the top of your program near your constants: decimal[,] smoothieListDecimal = {{ 5.99M, 6.99M, 7.99M, 8.99M }, { 6.99M, 7.99M, 8.99M, 9.99M }}; In this setup the cost for a particular smoothie would be based on a row and column of the table. For example, smoothieListDecimal [0, 3] would contain the price of a Regular King Smoothie. You will be able to use the selectedIndex for each of the dropdown lists to determine the row and column you need. TIP: You do not need a loop to search for the correct smoothie price. You only need to know the selectedIndex values for the row (smoothie style) and column (smoothie size) B. Array of Structures Approach: A different approach would be to use an array of structures. If you are going to use an array of structures, you could use a similar setup to the state/abbreviation program with the fields being regularDecimal and organicDecimal. You would then need an array of 4 structure elements (for each size) that you would initialize in the form load. 2. SMOOTHIE EXTRAS: A customer can order one or more extras for their smoothie. Toppings are $0.75 each (use a constant) and will be one of the following: Echinacea Bee Pollen Energy Booster 3. DISCOUNTS: A customer may receive a discount on their purchase. Discounts are computed before taxes and can be one of the following (use a constant): None – no discount Preferred customer card - 15% discount Coupon - 10% discount 4. TAXES: The final bill should also add in a state sales tax of 8% before calculating the amount due. You should incorporate a METHOD / FUNCTION to compute the tax. 5. CONSTANTS: Use appropriate constants for all numerical values that are predefined (e.g., extras, tax, discounts). FORMS SPECIFICATIONS AND VALIDATION 1. ABOUT FORM: Your program should have an “About” form that contains the typical information (program name, date, author, etc.). See sample EXE. 2. MAIN FORM (Customer Data): This form will need several components. There are also several required fields that should display appropriate error messages. When in doubt, refer to the sample EXE or post a question on the discussion board. 3. TEXT BOXES: You will use textboxes for the customer information. All fields must contain information or an error message will be displayed. • Customer Name TIP: You do not need to use a Try/Catch to do all the data validation since these are not numeric text fields. You can use a nested IF/ELSE setup to test the fields for the required input to make sure they are not blank. 4. COMBO BOXES/DROPDOWN LISTS • Smoothie Size: Should be one of the following – small, medium, large or king. Selection required. A size must be selected or an error should appear. Hint: Check to ensure the selectedIndex <> -1. • Smoothie Style: Should be one of the following – regular or organic. Selection required. A style must be selected or an error should appear. Hint: Check to ensure the selectedIndex <> -1. 5. CHECKBOXES/GROUPS: • Extras: Can be none, or, one or more of the following: Echinacea, Bee Pollen and Energy Booster. 6. RADIO BUTTONS/GROUPS: • Discount: May be none or 10% coupon or preferred customer (15% discount). 7. PULL DOWN MENUS (EXTRA CREDIT): The menu system should contain the following options (you can organize the menu choices however you’d like): • Calculate - Totals the customer's bill after adding any extras, deducting discounts and adding appropriate tax (assuming all data validation tests are passed). Displays the subtotal, discount, tax and amount due in the label box as currency. Note that if any validation error occurs, the program should not calculate or display any totals. • Clear - Clears all the text, check and option buttons, and totals. Repositions the cursor in the customer name text box for the next customer. • Help/About – Message box with your name and program name. • File/Exit - Exits the program. I have seen this posted before but wanted to see if someone would be able to explain more and possibly post screenshots of the code. Thank you in advance!
In: Computer Science
PYTHON: Turtle Command Interpreter
You will write a program that reads a sequence of codes, converts
them into Turtle commands, and then executes them. The codes are in
a Python list, passed as an argument to your function.
turtleRunner(t, x)
t is a Turtle
x is a list of Turtle commands
| (f, d) | Move forward by d pixels |
|---|---|
| u | Lift pen up |
| d | Put pen down |
| (l, d) | Turn left by d degrees |
| (r, d) | Turn right by d degrees |
| (c, s) | Change color to "s" |
| (w, d) | Change pen width to d |
For example [("f", 100), ("r", 30), ("c", "red"), "u", ("f",
50), ("r", 60), "d", ("f", 100)] will execute:
t.forward(100)
t.right(30)
t.color("red")
t.penup()
t.forward(50)
t.right(60)
t.pendown()
t.forward(100)
Your program will need to do the following:
x =
[("w",3),("c","red"),("f",100),("r",120),("c","blue"),("f",100),("r",120),("c","green"),("f",100)]
turtleRunner(t, x)
Draws the shape below:
isinstance(x, y) returns True if x is an instance of class y. So
isinstance(e, tuple) will return True if e is a Tuple.
(Note no quotes around tuple in the call)
isinstance(e, str) will return True if e is a String.
Starter code(please by off this):
# Tkinter
#
# Turtle Command Interpreter
#
# You will write a program that reads a list of codes, converts
them into Turtle commands, and then executes them.
#
# Code list:
# (f, d) Move forward by d pixels
# u Up
# d Down
# (l, d) Turn left by d degrees
# (r, d) Turn right by d degrees
# (c, s) Change color to "s"
# (w, d) Change width to d
#
# Example:
# [("f", 100), ("r", 30), ("c", "red"), "u", ("f", 50), ("r", 60),
"d", ("f", 100)]
#
# This will execute:
# t.forward(100)
# t.right(30)
# t.color("red")
# t.penup()
# t.forward(50)
# t.right(60)
# t.pendown()
# t.forward(100)
#
# Your program will need to do the following:
# 1) Define a function named turtleRunner(x), where x is a
list
# 2) Go through each element of x one at a time.
# 3) If the element is a tuple (if isinstance(e, tuple)):
# a) Determine if the code is f, r, or c
# b) Execute the correct turtle command using the
second part of the tuple (a distance or color)
# 4) If the element is a string (if isinstance(e, str)):
# a) Execute the correct turtle command
#
import turtle
def turtleRunner(t, x):
pass
w = turtle.Screen()
t = turtle.Turtle()
x =
[("w",3),("c","red"),("f",100),("r",120),("c","blue"),("f",100),("r",120),("c","green"),("f",100)]
turtleRunner(t, x)
In: Computer Science
the Unix/Linux commands
Whoami shows my username
In: Computer Science
Minor Cineplex
The Minor Cineplex is a local cinema in Neverland that has operated since 1989. It started off with only 1 theatre. Since then, the business has expanded and there are now 4 theatres. Minor Cineplex shows the same movie in every theatre. There are 20 seats in each row in all theatres.
Theatre 1, 2 and 3 have the same seating arrangements and ticket pricing scheme. Each theatre has 200 seats (i.e., 10 rows) divided equally in 2 sections: Front and Back. The ticket price is 250 Baht for the front section and 350 Baht for the back section.
Theatre 4 has only 100 premium seats in 5 rows. Ticket price is 500 Baht for all seats in row 1 to 4. The ticket price in row 5 is 700 Baht.
We are building a ticket selling system for Minor Cineplex. Note that we will only focus on building data models for each theatre and calculate the amount of tickets sold. You can assume that Minor Cineplex only sells tickets for the upcoming showtime (i.e., no advanced booking is allowed).
Design a system for Minor Cineplex so that it allows the box office staff to view and edit the movie title currently in theatres. It must allow the staff book a seat in the specified theatre (if available). The staff must be able to view the amount of tickets sold in the specified theatre as well as the total amount of tickets sold in all theatres.
Here are some design considerations:
Your program should provide the following menu.
Book a seat: The staff has to enter the theatre number along with the seat information to be booked (which includes the row and the seat numbers). The staff can only book one seat at a time. A confirmation message must be shown, if the booking is successful. A staff should be notified with a different message, if the seat is already taken.
Edit movie title: Minor Cineplex’s current policy is to show the same movie in all of its theatres. Note that this policy may be changed in the future.
View sales report: The sales report must show the movie title, the number of tickets sold and the sales amount (THB) for each theatre. The report must also show the total number of tickets sold and the sales amount (THB) in all theatres.
YOUR PROGRAM SHOULD BE IMPLEMENTED USING JAVA PROGRAMMING!!
In: Computer Science
Dear Colleague,
Earlier today I built my seventh website using HTML5, CSS3, and Bootstrap4. Bootstrap seems amazing, but it never did what it should do – make my website look better. Also, my page should have a blue theme that was provided in the CSS folder. This also didn’t work.
My website is supposed to look like what is shown in Figure 1 (see below). Someone told me that there are exactly 10 errors on index.html, 10 errors on contact.html, and 10 errors on events.html. Yes, 30 errors total! Can you help me find all of the errors?
Hint: You should not add ANY LINES to the code. There
will never be more than one error per line number.
index.html ( TOTAL 10 ERRORS HELP FIND AND LIST ERRORS
)
<!doctype html>
<html>
<head>
<head>Try Boro Kids Race Series</title>
<!-- Font Awesome -->
<link rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
<!-- Bootstrap CSS -->
<a
href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css"
rel="stylesheet">
<!-- JQuery -->
<a type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.min.js"></script>
</head>
<bootstrap>
<div class="container-fluid">
<nav class="navbar navbar-expand-lg navbar-dark
bg-info">
<a class="brand" href="#">
<img src="HeaderBoroRunningMan2.gif" width="auto" height="30"
alt="Running Man Logo">
</a>
<button class="navbar-toggler" type="button"
data-toggle="collapse" data-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle
navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="events.html">Events <span
class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link"
href="contact.html">Contact</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a class="nav-link"
href="http://www.tryborokidstri.org/" target="_blank">Try
Boro</a></li>
<li class="nav-item"><a class="nav-link"
href="https://www.faccebook.com/TryBoroKids/"
target="_blank"><img src="images/IconFacebook.png"
class="iconsocial" alt="Facebook" width="auto"
height="30"></a></li>
</ul>
</div>
</nav>
<div id="carouselIndicators" class="carousel slide"
data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel1" data-slide-to="0"
class="active"></li>
<li data-target="#carousel1" data-slide-to="1"
class="active"></li>
<li data-target="#carousel1" data-slide-to="2"
class="active"></li>
<li data-target="#carousel1" data-slide-to="3"
class="active"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100"
src="images/Banner1_100ChallengeBlueHue.jpg" alt="First
slide">
<div class="carousel-caption d-none d-md-block">
<h5>Try Boro Kids Race Series</h5>
<p>Unique Endurance Events</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/Banner2_ImageBlueHue.jpg"
alt="Second slide">
<div class="carousel-caption d-none d-md-block">
<h5>Try Boro Kids Race Series</h5>
<p>Running Events</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100"
src="images/Banner3_TrailRunBlueHue.jpg" alt="Third
slide">
<div class="carousel-caption d-none d-md-block">
<h5>Try Boro Kids Race Series</h5>
<p>Trail Running</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100"
src="images/Banner4_MedalsBlueHue.jpg" alt="Third slide">
<div class="carousel-caption d-none d-md-block">
<h5>Try Boro Kids Race Series</h5>
<p>Events that are rewarding!</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselIndicators"
role="button" data-slide="prev">
<span class="carousel-control-prev-icon"
aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselIndicators"
role="button" data-slide="next">
<span class="carousel-control-next-icon"
aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="row p-5">
<div class="col-xs-12">
<h2>Try Boro Events</h2>
<p>The Try Boro Kids Races Series is a non-profit
organization that puts on unique endurance vents to help get kids
active. Founded in 2009 with one triathlon. This event was hosted
by Murfreesboro Parks and Recreation and their SportsCom facility.
That first year saw 175 kids swim, bike, and run and since then the
series has hosted 17 events. For the past 4 years, the series has
hosted a 2.5K/5K Run in May, a triathlon in August, and a trail in
October. </p>
<p>In 2016, the series is partnering with the
Better Boro Project, which is part of an initiative by the city of
Murfreesboro to promote health and fitness. As part of this
initiative, the Try Boro Kids Race Series will host the clinics in
April, 2.5K/5K Run in May, and the trail run in October. The series
will also provide support for other events such as Read to Succeed
and Murph's Fun Run.</p>
</div>
</div>
<footer class="footer bg-primary text-center
text-white">Copyright Try Boro</footer>
</div>
</body>
</html>
HELP LIST AND FIND THE 10 ERRORS
In: Computer Science
10. Which of the following concurrency control protocols ensure both conflict serializability and freedom from deadlock?
(I) 2-phase locking
(II) Time-stamp ordering
(a) < some combination of (I) and (II) >
(b) < some combination of (I) and (II) >
(c) < some combination of (I) and (II) >
(d) Neither (I) nor (II)
In: Computer Science
Write a C++ program to multiply two matrices a and b and print the result. Use two-dimensional arrays to represent the matrices.
In: Computer Science
The Questions Are of a Organization of Programming course.
A variable can be characterized by a collection of attributes. What is one such attribute? The response is Implicit heap-dynamic allocation. Why is the response that?
Does static type binding require the programmer to specify the type of the variable in the program? Please Explain the answer and why it is the answer.
A certain variable is assigned a value. At that time, new storage is allocated for that variable to fit the new value. What kind of allocation was most likely used? Please provide an answer and please explain why the answer is the answer.
In: Computer Science
In this assignment, students should create five Java classes called Point, Circle, Square, Rectangle, and TestAll, as well as a Java interface called FigureGeometry. The TestAll class should implement the main method which tests all of the other files created in the assignment. After the assignment has been completed, all six files should be submitted for grading into the Dropbox for Assignment 3, which can be found in the Dropbox menu on the course website. Students should note that only the *.java file for each class /interface needs to be submitted; No *.class files need to be submitted into the Dropbox. Please see below specific requirements for the files that must be created and submitted:
Point.java Description:
The Point class should be declared as a public class and should meet all the requirements listed below. Its purpose is to store the Point (width and height) of a two-dimensional, rectangular geometric figure.
Instance Variables:
private int width;//stores the width of a Point object private
private int height;//stores the height of a Point object
Constructor: Point()
Parameters:
int theWidth,
int theHeight
Purpose: initializes the width and height of a Point object in the following manner:
width = theWidth;
height = theHeight;
Methods:
public int getWidth(){//returns the width of a Point object in the following manner
return width;}
public int getHeight(){//returns the height of a Point object in the following manner:
return height;}
public void setWidth(int theWidth){//assigns the width of a Point object as follows:
width = theWidth;}
public void setHeight(int theHeight{//assigns the height of a Point object as follows:
height = theHeight;
}
FigureGeometry.java Description:
The FigureGeometry interface should be declared as a public interface and should meet all the requirements listed below. Its purpose is to declare all the necessary methods that any geometric figure, such as a circle, rectangle, or square, should contain. The FigureGeometry interface should also declare a numeric constant, called PI, which can be used by classes that implement the FigureGeometry interface. Remember that method declarations in an interface should not include modifiers such as public, static, or abstract.
Declaring a method within an interface as static is illegal and will cause a compilation error. Additionally, the declaration of interface methods using public or abstract modifiers is redundant, and soon such declarations will be deprecated. Students should also note that the inclusion of instance variables within an interface declaration is not allowed; only static constants may be defined within an interface declaration, and the use of the static modifier on constants is also redundant. Basically, students should remember one general rule of thumb concerning interface declarations: Only one modifier should be used in an interface declaration--final should be used to declare constants.
public interface FigureGeometry{final float PI = 3.14f;
//Classes that implement the FigureGeometry interface MUST override this method which should return the geometric area of a figure:
//In an interface, methods are always public and abstract. Using these unnecessary modifiers is redundant, and future versions of
//Java may not support them.
float getArea ();
//Classes that implement the FigureGeometry interface MUST also override this method which should return the geometric perimeter of a //figure:
float getPerimeter ();}
Circle.java Description:
The Circle class should be declared as a public class that implements the FigureGeometry interface described above. Its purpose is to store the radius of a circular figure and provide the methods necessary to calculate the area and perimeter of such a figure.
Instance Variables:
private float radius;//stores the radius of a Circle object
Constructor: Circle()
Parameters:
float theRadius;
Purpose:initializes the radius of a Circle in the following manner:
radius = theRadius;
Methods:
1-public float getRadius(){//returns the radius of a Circle object as follows:
return radius;
}
2-public float getArea(){//returns the area of a Circle object as follows:
return getRadius() * getRadius() * PI;
3-public float getPerimeter(){//returns the perimeter of a Circle object as follows:
return getRadius() * 2 * PI;
}
4-public void setRadius(float theRadius){//assigns the radius of a Circle object as follows:
radius = theRadius;
}
The following coding example illustrates a version of the Circle class:
public class Circle implements FigureGeometry{//Stores the radius of this figure:
private float radius;
//Returns the radius of this figure:
public float getRadius (){return radius;}
//Returns the area of this figure:
public float getArea (){
return getRadius() * getRadius() * PI;}
//Returns the perimeter of this figure:
public float getPerimeter (){ return getRadius() * 2 * PI;}
//Assigns the radius of this figure:
public void setRadius (float theRadius){radius = theRadius;
}
}
Square.java Description:
The Square class should be declared as a public class that
implements the FigureGeometry interface and should meet all the
requirements listed below. Its purpose is to store the Point of a
square figure (using the Point class described above and provide
the methods necessary to calculate the area and perimeter of such a
figure.
Instance Variables:
private Point point; //stores the Point of a Square object
Constructor: Square()
Parameters:
Point p;
Purpose:initializes the object point of the Square object in the following manner:
point= p;
Methods:
1-public float getSideLength(){//returns the length of the side of the square as follows:
return point.getWidth();}
2-public float getArea(){//returns the area of a Square object as follows:
return getSideLength() *getSideLength();}
3-public float getPerimeter(){//returns the perimeter of a Square object as follows:
return getSideLength() * 4;}
4-public void setPoint(Point p){//assigns the point of a Square object as follows:
point= p;}
Rectangle.java Description:
The Rectangle class should be declared as a public class that implements the FigureGeometry interface described above. Its purpose is to store the Point of a rectangular figure (using the Point class described above) and provide the methods necessary to calculate the area and perimeter of such a figure.
Instance Variables:
private Point point;//stores the point of the Rectangle object
Constructor: Rectangle()
Parameters:
Point p;
Purpose: initializes the Point of a Rectangle object in the following manner:
point = p;
Methods:
1-public int getWidth()
{//returns the width of a Rectangle object as follows:
return point.getWidth();}
2-public int getHeight()
{//returns the height of a Rectangle object as follows:
return point.getHeight();}
3-public float getArea()
{//returns the area of a Rectangle object as follows:
return getWidth() * getHeight ();}
4-public float getPerimeter()
{//returns the perimeter of a Rectangle object as follows:
return (getWidth+getHeight()) * 2;}
5-public void setPoint(Point p)
{//assigns the point of a Rectangle object as follows:
point = p;}
TestAll.java Description:
The TestAll class should be declared as a public class and should meet all the requirements listed below. Its purpose is to implement a main method which creates three objects--a Circle object, a Square object, and a Rectangle object-- and test each of the files that have been designed above. You should already be familiar with how to instantiate objects and print values to the screen using System.out.println(...). Therefore, the actual implementation code for this assignment will not be provided. You may organize the output of data according to their own specifications. However, the main method must perform the following tasks:
In: Computer Science
MATLAB PROBLEM
convert the for loop to a while loop.
vec= [1 2 3 4 5]
newVec= []
for i=vec
if i>5
new vec=[newvec, i]
end
end
end
In: Computer Science
1. a) Prove that if n is an odd number then 3n + 1is an even number. Use direct proof.
b) Prove that if n is an odd number then n^2+ 3 is divisible by 4. Use direct proof.
2. a) Prove that sum of an even number and an odd number is an odd number. Use direct proof.
b) Prove that product of two rational numbers is a rational number. Use direct proof.
3. a) Prove that if n2is an even number then n is an even number. Use indirect proof.
b) Prove that if n3is an odd number then n is an odd number. Use indirect proof
4. Prove that n2is an even number if and only if 3n + 1 is an odd number by proving
a) If n2is even then 3n + 1 is odd.
b) If 3n + 1 is odd then n^2 is even.
In: Computer Science
**PLEASE ANSWER ALL QUESTIONS**
Ananada is sitting on a train and overhears someone on his phone bragging that he has a massive network of computers at his fingertips that have been compromised with some form of malware. He tells the person on the other end of the call that they can have all these computers attack a target in unison. Which of the following terms might describe the person whose conversation she overheard?
| a. |
Bot herder |
|
| b. |
Shepherd |
|
| c. |
Alien wrangler |
|
| d. |
Zombie |
Tyrese has just been hired as a cybersecurity analyst at a major hospital in Colorado. Which of the following regulations might he need to be familiar with?
| a. |
ICO |
|
| b. |
CCPA |
|
| c. |
PIPEDA |
|
| d. |
HIPAA |
Albrecht has noticed a number of clients on the network attempting to contact the same external IP address at a constant rate of once every five minutes over the past 72 hours. Which of the following might be the cause of his concern?
| a. |
The computers may have formed a distributed computing configuration that allows them to work as a single command and control system. |
|
| b. |
The computers are performing a port scan against a victim computer. |
|
| c. |
The computers may be infected with malware that has made them part of a botnet. |
|
| d. |
The computers are currently taking part in a DDoS attack against the destination IP address. |
In: Computer Science