Write a program that prompts the user to enter a date in the
format mm/dd/yyyy
where mm is the month , dd is the day and yyyy is a 4 digit
year
Check if the date is valid by seeing month is between 1 and 12, day
is between 1 to 31 and year is between 1800 to 3000. Also check
that if month is 2, day is between 1 to 29
If the date is valid then display the date back in following format
dd month year. Use of SimpleDateFormat Java Class is NOT allowed to
do this assignment. You need to use String functions from Chapter 4
to do this assignment.
Following is a sample run:
Enter a date in the format mm/dd/yyyy:
02/23/1999
23 Feb 1999
Following is another sample run:
Enter a date in the format mm/dd/yyyy:
02021999
Input String Length should be 10
Following is another sample run:
Enter a date in the format mm/dd/yyyy:
02-23-2000
Invalid Date Format
Following is another sample run:
Enter a date in the format mm/dd/yyyy:
23/02/2000
Invalid Date
In: Computer Science
1)
The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program.
Grading
When you have completed your program, click the Submit button to record your score.
// Uses
DisplayWebAddress method three times
using static System.Console;
class DebugSeven1
{
static void Main()
{
DisplayWebAddress;
Writeline("Shop at Shopper's World");
DisplayWebAddress;
WriteLine("The best bargains from around the world");
DisplayWebAddres;
}
public void DisplayWebAddress()
{
WriteLine("------------------------------");
WriteLine("Visit us on the web at:");
WriteLine("www.shoppersworldbargains.com");
WriteLine("******************************");
}
}
2)
The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program.
Grading
When you have completed your program, click the Submit button to record your score.
// Address an envelope
using names and addresses
// stored in two parallel arrays
using static System.Console;
class DebugSeven2
{
static void Main()
{
string[] addressees = {"Ms. Mary Mack", "Mr. Tom Thumb", "Dr.
Seuss"};
string[] addresses = {"123 Main", "456 Elm" "87 Maple"};
for(int x = 0; x < addressees.Length; ++x)
AddressEnvelope(addresses[x], addresses[x]);
}
private static void AddressEnvelope(string person, string
street)
{
WriteLine("To : {0}", person);
WriteLine(" {1}", street);
for(x = 0; x < 30; ++x)
Write("-");
WriteLine();
}
}
In: Computer Science
An engine operates with four essential variables controlling its operation. For the engine to be operating properly, at least two of its control variables must be present at the same time. However, when the machine is not operating correctly, we wish to have some signal to alert us to the problem. Design a circuit to implement the state when the alarm signal is present
In: Computer Science
c++ problem:
Implement a class money. You must have friend functions for I/O that overload << and >>. You must have multiple constructors, You must implement a percentage method,+,-, <,>. There is a starting money class in your text.
Example output:
Enter an amount of money: $14.33
Your amount is $14.33
My amount is $10.09
One of us is richer.
You have more money than me.
10% of your money is: $$1.43
$14.33 + $10.09 equals $24.42
$14.33 - $10.09 equals $4.24
Press any key to continue . . .
In: Computer Science
What (if anything) is wrong with the following code:
int redCount = 0, blueCount = 0;
Scanner scan = new Scanner(System.in);
System.out.println("Please make a selection: ");
String option = scan.next();
while(!option.startsWith("q") || !option.startsWith("Q"))
{
if(option.equals("red"))
{
redCount++;
}
else
{
blueCount++;
}
System.out.println("Please enter another value: ");
option = scan.next();
}
System.out.println("Red: " + redCount + ", Blue: " + blueCount);
|
The condition is not a boolean expression. |
||
|
A variable is out of scope. |
||
|
There is nothing wrong with this code. |
||
|
It will result in an infinte loop. |
||
|
It contains a logic error that will cause it to function incorrectly. |
What (if anything) is wrong with the following code:
int redCount = 0, int blueCount = 0;
Scanner scan = new Scanner(System.in);
System.out.println("Please make a selection: ");
String option = scan.next();
while(!option.toLowerCase().startsWith("q"))
{
if(option.equals("red"))
{
redCount += 1;
}
else
{
blueCount += 1;
}
System.out.println("Please enter another value: ");
option = scan.next();
}
System.out.println("Red: " + redCount + ", Blue: " + blueCount);
|
A variable is out of scope. |
||
|
The condition is not a boolean expression. |
||
|
It will result in an infinte loop. |
||
|
There is nothing wrong with this code. |
||
|
It contains a logic error that will cause it to function incorrectly. |
In: Computer Science
C language
· Pointers · Dynamic memory allocation · Functions · Arrays (dynamically allocated)
PROBLEM: The user of your program will use it to do some
elementary calculations for an unknown number of simple data sets.
The data in each set consists of a number of floating point values,
but the number of
the values to be entered will be input by the user, so you do not
know in advance how many values there will be in each data set.
Therefore, you cannot use a static array in C to
store these numbers, because a statically declared array has a
fixed size, which cannot be changed after the program begins
running.
First, you should prompt the user to enter the number of
data sets. The user will enter an integer greater than 1 to
indicate the number of data sets.
You should then prompt the user to enter the number of
floating point values in each data set (which the user will enter
as an integer greater than 0), followed by the floating point
values themselves on the same line (newline will follow
the last floating point value on the line). Your program needs to
read the user input, and store the floating point values in each
data set in a dynamically allocated array of the appropriate
size.
After getting the values in each data set, your program
should repeatedly do the following two things:
Select the data set to do operations on by number, with the
following prompt:
Enter the number of the data set on which you wish to do
calculations:
The user will enter an integer value, followed by newline, in
response to this prompt (the user will enter 1 for the first data
set, 2 for the second, etc.), and based on the value entered, your
program must be able to access the values in the appropriate data
set in the dynamically allocated storage which you have created,
and then do what is described immediately below.
Your program should then prompt the user to choose one of the
following options for a calculation based on the data set chosen by
the user (ask the user to enter one of the six numbers, followed by
enter):
1. Find the minimum value.
2. Find the maximum value.
3. Calculate the sum of all the values.
4. Calculate the average of all the values.
5. Print the values in the data set.
6. Exit the program.
After the user selects one of these six options, your program
should do the necessary calculation or printing of the data based
on the user's choice (or terminate the program), and output the
result with an appropriate message, for
example:
The maximum value in the data set is: 569.45
The results for options 1, 2, 3, and 4 should be printed out as
floating point values with 2 digits of precision, and the result
for option 5 should be to output the values in the data set in the
order in which they were input, with two digits of precision for
each value, and with any two values separated by a tab (\t).
Sample Data Set Input (This does not include user responses to
the prompts to select a data set or to select an operation to
perform)
6
3.45 2.37 85.32 34.5 569.45 335.2 193.4 74.39
6 23.45 32.37 185.32 364.5 179.4
144.39 7 35.45 121.47 42.32 44.5
249.75 385.9 113.4 4 44.45 567.37 311.32
22.45 2.37 85.32 34.5 569.45
335.2 193.4 74.39 122.45 413.2 89.32
2
1
3
2
4
3
5
4
6
5
6
In: Computer Science
Using the predicate symbols shown and appropriate quantifiers, write each English statement as a predicate wff. (The domain is the whole world.) (
A(x): x is an animal B(x): x is a bear H(x): x is hungry W(x): x is a wolf
a. Bears are animals.
b. Some animals are hungry bears.
c. No wolf is a bear.
In: Computer Science
JAVA PROGRAMMING
source code using appropriate programming style (e.g., descriptive variable names, indenting, comments, etc.).
1. Using the remainder (%) operator, write a program that inputs an integer and displays if the number is even or odd.
B. Write the same program using some other technique without using the remainder (%) operator.
In: Computer Science
ArrayStack:
package stacks;
public class ArrayStack<E> implements Stack<E>
{
public static final int CAPACITY = 1000; // Default
stack capacity.
private E[] data; //Generic array for stack
storage.
private int top = -1; //Index to top of stack./***
Constructors ***/
public ArrayStack()
{
this(CAPACITY);
}
//Default constructor
public ArrayStack(int capacity)
{
// Constructor that takes
intparameter.
data = (E[]) new
Object[capacity];
}
/*** Required methods from interface ***/
public int size()
{
return (top + 1);
}
public boolean isEmpty()
{
return (top == -1);
}
public void push(E e) throws
IllegalStateException
{
if(size() == data.length)
{
throw new
IllegalStateException("Stack is full!");
}
data[++top] = e;
}
public E top()
{
if(isEmpty())
{
return
null;
}
return data[top];
}
public E pop()
{
if(isEmpty())
{
return
null;
}
E answer = data[top];
data[top] = null;
top--;
return answer; }
}
Recall: In the array based implementation of the stack data type, the stack has a limited capacity due to the fact that the length of the underlying array cannot be changed. In this implementation, when a push operation is called on a full stack then an error is returned and the operation fails. There are certain applications where this is not useful. For example, a stack is often used to implement the \undo" feature of text editors, or the \back" button in a web browser. In these cases, it makes sense to remove the oldest element in the stack to make room for new elements. A similar data structure, called a leaky stack is designed to handle the above type of situation in a dierent manner. A leaky stack is implemented with an array as its underlying storage. When a push operation is performed on a full leaky stack, however, the oldest element in the stack is \leaked" or removed out the bottom to make room for the new element being pushed. In every other case, a leaky stack behaves the same as a normal stack. Write an implementation of the leaky stack data structure. Your class should be generic and implement the following public methods: push, pop, size, and isEmpty. Your class must also contain at least two constructors: one where the user does not specify a capacity and a default capacity of 1000 is used, and one where the user does specify a capacity.
Hint: The following is a skeleton of the class to get started (You will have to fill in the missing implementations of the abstract methods from the Stack interface):
public class LeakyStack implements Stack {
public static final int DEFAULT = 1000;
private E[] stack; private int size = 0;
private int stackTop = -1;
public LeakyStack()
{
this(DEFAULT);
}
public LeakyStack(int c);
public void push(E e);
public E pop();
public boolean isEmpty();
public int size(); }
In: Computer Science
Create a class called Cuboid in a file called
cuboid.py. The constructor should take parameters that sets a
private variable for each side of the cuboid. Overload the
following operators: +, -, <, >, ==, len(), and str(). Return
a cuboid with the appropriate volume for the arithmetic operators.
Use the volume of the cuboid to determine the output of the
overloaded comparison operators. Use the surface area of the cuboid
to calculate the result of len(). For str() return a string that
displays the side lengths, volume, and surface area. Let the user
enter values used to create two Cuboid objects. Then print out all
results of the overloaded operators (using the operator, not
calling the dunder method). Create a file called assn14-task1.py
that contains a main() function to run your program. It is fine for
the program to only run once then end. You DO NOT need to create
loop asking use if they want to "Play Again".
Note: The most complicated part of this is the + and
-. Remember that arithmetic operators should return the same type
as the operands, so a cuboid should be returned. The returned
cuboid is based on the volume, which means you'll need to figure
out what the side lengths should be. They can be anything
valid.
Rubric
5 pts: All operators overloaded
properly
5 pts: Print results using the overloaded
operators
5 pts: Proper output
Note: No software dev plan or UML
required
In: Computer Science
To gain approval for a new network design, upgrade, or
enhancement, you will have to present your network design, project
costs, and project plan to all the stakeholders, which includes
senior leadership. Through the last five weeks, you have created
your network design, and now it is time to promote that design and
get approval for this project.
During the course, you have designed a network to meet
the specific needs of your client. Now, it is time to showcase that
design. When you are dealing with a client, communication plays a
key role in your professional success. You may have a very
effective design, but you may not still be able to achieve maximum
client satisfaction if you cannot communicate your design to your
client properly.
For this part of the Final Project, review this week’s resources.
Give special attention to the resource “Oral Presentation and
PowerPoint.” Remember the following when developing the
presentation:
Keep the presentation short and simple.
Do not load the presentation down with paragraphs of
text. Keep it simple and use images.
Make sure that the presentation is informative and
that it uses facts and figures.
When presenting to a non-technical audience, try to
refrain from making it too technical. Remember that the
presentation would normally be presented to leadership who most
likely will not understand the technical information.
Explain clearly to the leadership the costs and
benefits that the network will offer to the organization.
Presentation (6–10 slides):
Create a PowerPoint presentation with a narrative overlay. The
overall slide show must be in the 8–10 minute range. The
presentation must be engaging, organized, easy to understand,
appropriate for the intended audience, and complete the
following:
Introduce the presentation
Describe the network in layman’s terms
Identify how the network meets each specific client
need
Describe how the network ensures security
Provide technical details with which the client needs
to be familiar
Instruct the client on any technical needs for
supporting the network
Summarize the presentation
Note: To complete this presentation, you must have
Microsoft PowerPoint 2007 or a higher version loaded on your
computer. In addition, you must have a microphone to record your
oral narrative to accompany the presentation.
Once the PowerPoint slides are complete, you have created a written
copy of the narrative, and you have tested the narrative to be sure
it is the proper overall length (time), you will embed the oral
narrative into the file. To embed the narrative, complete the
following steps.
Beginning with the first slide:
Select the Slide Show Tab—Record Narration—Set microphone level.
Talk into your microphone to make sure it is working
properly.
Click OK—Begin your narrative for the first
slide.
Advance to the next slide (left click)—Be sure you are
done speaking before you left click.
Record the narrative for the second slide.
Continue advancing through the slides and recording
your narrative.
After the last slide, you will be asked if you want to
save the slide timings—Select SAVE.
Now start your slide show. The show will progress at
the pace you set while creating the narrative for each
slide.
If you need to redo the recording, simply go back to
the first slide. Then, select the Slide Show Tab and re-record your
narrative, or you may choose to re-record just one slide at a
time.
REPEAT steps 1–8 until you are satisfied with the
presentation and your slide show is completed in 6–10
minutes.
Save the PowerPoint presentation with embedded narrative.
Submit your Final Project Part 5 through uploading your file
(saving it according to the filenaming convention specified in this
Assignment’s submission link) by Day 5.
In: Computer Science
Project Name: AWS: EC2 + EBS + Elastic IP
Technology: Cloud Computing
Market: Delivery for Traditional SME with Scale for Growth
Student:
Directions: Configure infrastructure on AWS as detailed below. Completely document your process as outlined. Your documentation / report should be approximately 2 pages of relevant detail that would allow a user to rebuild your design / configuration from scratch.
___________________________________________________________________
Technologies:
AWS: EC2 (Linux VM Instance) + EBS (Persistent Disk) + Elastic IP ("Static" IP for Instance)
Intended Services to Provision:
Linux Server (alternately a Windows Server)
Web Server (nginx, Apache, or IIS)
Static IP
Design:
Your goal is to document the process of setting up a server (on EC2) running nginx (or Apache, IIS) with a static IP on AWS (using the technologies mentioned above).
Important Note:
At this stage in the course we are beginning to architect, configure, and deploy real services in the public cloud (specifically AWS). When you are beginning designing and deploying services, documentation can be of great help as replicating exact configurations can at times be challenging. Note: When we do not replicate a configuration exactly, we can be creating security issues (assuming we had a “secure” or robust design initially). Another reason to develop good documentation is that it gives a good idea of what should be happening with systems and it can be reviewed and refined over time so that the quality of your designs and configurations increases as you practice.
Questions to Answer:
What is the purpose of EBS?
Does EBS persist after you delete a VM instance?
Can you reuse an EBS in a new VM instance?
What purpose does an Elastic IP serve?
How could an Elastic IP help you cope with upgrades?
As an organization grows, what are some aspects to consider with regard to EC2 Instances, EBS, and Elastic IPs if any (i.e. aspects to consider: architectural, performance, cost, etc.)?
Documentation:
[Include your documentation below]
Deliverable(s):
Use this document as a base and include your ideas here. Submit and upload to Canvas in the assignment area for this project.
Remember that the better the quality of your documentation, the greater the likelihood that you can reproduce a configuration for deploying a production system or rebuilding your production infrastructure after a disaster.
*** Note: Be sure to utilize Free Tier eligible or a low cost option of your choice. After your workload has been designed, deployed, tested, and documented, be sure to delete, decommission instances so as to not be continually charged for services.
In: Computer Science
Consider which layer of the OSI-model is the most appropriate
for the
following functions and devices.
(a) Routing:
(b) SSH-connection for remote use:
(c) Ethernet-media repeater:
(d) Ethernet-switch:
(e) SNMP-based network management agent running in Ethernet
switch:
(f) Error Detection:
(g) Fiber cable:
In: Computer Science
While Base64 is a weak encryption standard it is still used to provide a basic means of encryption for email servers. Answer the following questions and provide a discussion about the Base64 Encryption Standard. Remember the initial posting is 100 words or more, and the replies are 60 words or more.
What is Base64?
Name two Services that use Base64?
Why is Base64 still used?
In: Computer Science
(a) How are rules for lexical analysis written? (b) What are these rules used for?
In: Computer Science