Write a java program that will read a file called stateinfo.txt and will store the information of the file into a map. The stateinfo.txt file contains the names of some states and their capitals. The format of stateinfo.txt file is as follows.
State Capital
--------- -----------
NSW Sydney
VIC Melbourne
WA Perth
TAS Tasmania
QLD Brisbane
SA Adelaide
The program then prompts the user to enter the name of a state. Upon receiving the user input, the program should display the name of the capital for that particular state. Assume that the name of the state that a user may enter already exists in the stateinfo.txt file.
In: Computer Science
Write a program that prompts the user to insert an item into a stack, delete an item from the stack, or display all the items in the stack. Assume that the stack maximum capacity is 10. Here is sample run
. Stack operation menu:
1. Insert
2. Delete
3. Display
4. Quit
In: Computer Science
Making a blackjack game in javascript
In: Computer Science
What is the difference between Computer Science and Software Engineering? (Academic and in your “own” words response)
Give examples of what is considered Computer Science and what is considered Software Engineering. Be very specific.
What is your major and why?
---------------
What is an Solution Architect?
What is the value of a AS? What skills are needed to be a good
SA?
---------------
What is Requirements Engineer?
What is the value of a RE? What skills are needed to be a good RE?
--------------
Use sources from Software Engineering by Ian Sommerville when applicable.
In: Computer Science
What is the difference between software copyrights and software patent ? NO plagiarism please.
In: Computer Science
A simple c program is needed to create encrypt and decode social security numbers. Then a validation must be used to make sure there are no invalid numbers.
**********************************************C PROGRAMMING*********************************************************************************
char social[][12] =
{"164-55-0726","948-44-1038","193-74-0274","458-57-2867","093-00-1093","159-56-9731","695-21-2340","753-66-
6482","852-73-4196","648-81-1456","879-61-1829","123-87-0000","000-65-3197","741-85-9632","963-25-7418"};
Create a function that will accept as input a properly formatted
social security number.
Then increment each digit by one. If the digit is "9" then make it
a "0". Return a properly formatted
social security number.
Then create a function that will do the opposite. This function
will take an encoded social security
number and convert it back into an unencrypted social security
number. The de-encoded number is
what this function will return.
Create a function to scan all of the patient's social security
numbers and detect if any of them are
invalid.
A Social Security Number (SSN) consists of nine digits, commonly
written as three fields separated by
hyphens: AAA-GG-SSSS. The first three-digit field is called the
"area number". The central, two-digit field
is called the "group number". The final, four-digit field is called
the "serial number". Any SSN conforming
to one of the following criteria is an invalid number:
Any field all zeroes (no field of zeroes is ever
assigned).
First three digits above 740
If you detect an invalid social security number, print the
patient's name, their social security number,
and then either "area number", "group number", or "serial number"
to indicate where the problem with
the social security number was detected.
In: Computer Science
********************************************C PROGRAMMING*************************************************************************************
char lname[][10]={"Johnson","Williams","Ling","Albin","Anderson","Baca","Birner","Dominguez","Aimino", "Armstrong","Beard","Calderon","Carter","Chaname","Chaney"};
char fname[][10] ={"Fred","Betty","Hector","Ross","Jason","Elisa","Dalton","Javier","Ann","Addison","Cindy","Yamil","Thomas","Bryan","Kris"};
char middle[] = {'N','L','X','L','O','L','M','B','S','T','J','C','P','D','Z'};
char city[][10] = {"Lakeland","Orlando","Tampa","Lakeland","Tampa","Lakeland","Orlando","Orlando", "Lakeland","Lakeland","Orlando","Tampa","Tampa","Lakeland","Orlando"};
Create a report that lists all of the cities that patients live
in and provide a count for
each city of how many patients come from that city. Print this list
out in alphabetical
order based on city name.
In: Computer Science
In: Computer Science
home / study / engineering / computer science / computer science questions and answers / instructions write a program to convert the time from 24-hour notation to 12-hour notation ...
Question: Instructions Write a program to convert the time from 24-hour notation to 12-hour notation and vi...
Instructions
Write a program to convert the time from 24-hour notation to 12-hour notation and vice versa. Your program must be menu driven, giving the user the choice of converting the time between the two notations.
Furthermore, your program must contain at least the following functions:
In: Computer Science
In: Computer Science
In C++ Valid Palindrome
In this assignment, you need to implement a bool isPalindrome(string s) function. Given a string s, isPalindrome(s) can determine if s is a palindrome, considering only alphanumeric characters and ignoring cases.
Note: for the purpose of this problem, we define empty string as valid palindrome.
Example 1: Input: ”A man, a plan, a canal: Panama” Output: true
Example 2: Input: ”race a car” Output: false
Requirement: There are many methods to check if a string is a palindrome or not. In this assignment, you need to use stack AND queue to in your implementation.
Suggestions: You don’t need to create the stack and queue classes by yourself. You can use the stack and queue implemention provided on Blackboard or use STL directly.
Consider all possible cases.
In: Computer Science
Create 6 tags with text inside them (in a valid HTML page,) color each differently. All show up on the page at this point... it's better to try to have everything upfront and in the open 1st and later have them hide, hover, or whatever interaction they will do. See the video for the text, don't bother matching the colors in the video.
Validate the HTML. Bugs multiply as you make the page more complex; a CSS problem could actually be an HTML problem.
Find the CSS property to HIDE something using CSS (there are two different ones that would work.) Hide all the tags by default. Knowing how to hide things with CSS is extremely useful (not just necessary for this assignment.)
Using Media Queries show the proper tags depending upon the device changes:
show landscape when the device is in landscape orientation
show portrait when the device is in portrait orientation
show >300 wide when the device is over 300px wide
show >300 tall when the device is over 300px high
show HD TV when the device the exact aspect ratio is 16/9 (there is a feature for aspect ratio; in firefox to preview you will need the exact window size for that ratio, you do not have to use HD you can use smaller numbers; equation: width = height*16/9. Also, you can look at the video)
show big when the device is above in 400px width and height.
Optional: instead of px pixel units, try using rem units. If you do, you should look up what a root em unit is so you know how big they are.
In: Computer Science
Consider sending a 2,000-byte datagram into a link with a MTU of 980 bytes. Suppose the
original datagram has the identification number 227. How many fragments are generated? For
each fragment, what is its size, what is the value of its identification, fragment offset, and
fragment flag?
In: Computer Science
The Luxury Ocean Cruise Outings company has provided Global Rain with a software specification document that details a menu-driven software application. Other developers on your software development team have already begun this project by creating the Ship, Cruise, Passenger, and Driver classes. You will modify the classes by including attributes and their proper data structures, writing methods to perform required functionality and behavior, and making sure that your program performs input validation and exception handling.
--------DRIVER.JAVA---------
import java.util.ArrayList;
import java.util.Scanner;
import static java.lang.Integer.parseInt;
public class Driver {
// class variables (add more as needed)
private static ArrayList shipList = new ArrayList();
private static ArrayList cruiseList = new ArrayList();
private static ArrayList passengerList = new ArrayList();
public static void main(String[] args) {
initializeShipList(); // initial ships
initializeCruiseList(); // initial cruises
initializePassengerList(); // initial passengers
// add loop and code here that accepts and validates user
input
// and takes the appropriate action. include appropriate
// user feedback and redisplay the menu as needed
}
// hardcoded ship data for testing
// Initialize ship list
public static void initializeShipList() {
add("Candy Cane", 20, 40, 10, 60, true);
add("Peppermint Stick", 10, 20, 5, 40, true);
add("Bon Bon", 12, 18, 2, 24, false);
add("Candy Corn", 12, 18, 2, 24, false);
}
// hardcoded cruise data for testing
// Initialize cruise list
public static void initializeCruiseList() {
Cruise newCruise = new Cruise("Southern Swirl", "Candy Cane",
"Miami", "Cuba", "Miami");
cruiseList.add(newCruise);
}
// hardcoded cruise data for testing
// Initialize passenger list
public static void initializePassengerList() {
Passenger newPassenger1 = new Passenger("Neo Anderson", "Southern
Swirl", "STE");
passengerList.add(newPassenger1);
Passenger newPassenger2 = new Passenger("Trinity", "Southern
Swirl", "STE");
passengerList.add(newPassenger2);
Passenger newPassenger3 = new Passenger("Morpheus", "Southern
Swirl", "BAL");
passengerList.add(newPassenger3);
}
// custom method to add ships to the shipList ArrayList
public static void add(String tName, int tBalcony, int
tOceanView,
int tSuite, int tInterior, boolean tInService) {
Ship newShip = new Ship(tName, tBalcony, tOceanView, tSuite,
tInterior, tInService);
shipList.add(newShip);
}
public static void printShipList(String listType) {
// printShipList() method prints list of ships from the
// shipList ArrayList. There are three different outputs
// based on the listType String parameter:
// name - prints a list of ship names only
// active - prints a list of ship names that are "in service"
// full - prints tabbed data on all ships
if (shipList.size() < 1) {
System.out.println("\nThere are no ships to print.");
return;
}
if (listType == "name") {
System.out.println("\n\nSHIP LIST - Name");
for (int i = 0; i < shipList.size(); i++) {
System.out.println(shipList.get(i));
}
} else if (listType == "active") {
System.out.println("\n\nSHIP LIST - Active");
// complete this code block
}
} else if (listType == "full") {
System.out.println("\n\nSHIP LIST - Full");
System.out.println("-----------------------------------------------");
System.out.println(" Number of Rooms In");
System.out.print("SHIP NAME Bal OV Ste Int Service");
System.out.println("\n-----------------------------------------------");
for (Ship eachShip: shipList)
eachShip.printShipData();
} else
System.out.println("\n\nError: List type not defined.");
}
public static void printCruiseList(String listType) {
if (cruiseList.size() < 1) {
System.out.println("\nThere are no cruises to print.");
return;
}
if (listType == "list") {
System.out.println("\n\nCRUISE LIST");
for (int i=0; i < cruiseList.size(); i++) {
System.out.println(cruiseList.get(i));
}
} else if (listType == "details") {
System.out.println("\n\nCRUISE LIST - Details");
System.out.println("------------------------------------------------------------------------------------------");
System.out.println("
|----------------------PORTS-----------------------|");
System.out.print("CRUISE NAME SHIP NAME DEPARTURE DESTINATION
RETURN");
System.out.println("\n-----------------------------------------------------------------------------------------");
for (Cruise eachCruise: cruiseList)
eachCruise.printCruiseDetails();
} else
System.out.println("\n\nError: List type not defined.");
}
public static void printPassengerList() {
if (passengerList.size() < 1) {
System.out.println("\nThere are no passengers to print.");
return;
}
System.out.println("\n\nPASSENGER LIST");
System.out.println("-----------------------------------------------------");
System.out.print("PASSENGER NAME CRUISE ROOM TYPE");
System.out.println("\n-----------------------------------------------------");
for (Passenger eachPassenger: passengerList)
eachPassenger.printPassenger();
}
// display text-based menu
public static void displayMenu() {
System.out.println("\n\n");
System.out.println("\t\t\tLuxury Ocean Cruise Outings");
System.out.println("\t\t\t\t\tSystem Menu\n");
System.out.println("[1] Add Ship [A] Print Ship Names");
System.out.println("[2] Edit Ship [B] Print Ship In Service
List");
System.out.println("[3] Add Cruise [C] Print Ship Full
List");
System.out.println("[4] Edit Cruise [D] Print Cruise List");
System.out.println("[5] Add Passenger [E] Print Cruise
Details");
System.out.println("[6] Edit Passenger [F] Print Passenger
List");
System.out.println("[x] Exit System");
System.out.println("\nEnter a menu selection: ");
}
// Add a New Ship
public static void addShip() {
// complete this method
}
// Edit an existing ship
public static void editShip() {
// This method does not need to be completed
System.out.println("The \"Edit Ship\" feature is not yet
implemented.");
}
// Add a New Cruise
public static void addCruise() {
// complete this method
}
// Edit an existing cruise
public static void editCruise() {
// This method does not need to be completed
System.out.println("The \"Edit Cruise\" feature is not yet
implemented.");
}
// Add a New Passenger
public static void addPassenger() {
Scanner newPassengerInput = new Scanner(System.in);
System.out.println("Enter the new passenger's name: ");
String newPassengerName = newPassengerInput.nextLine();
// ensure new passenger name does not already exist
for (Passenger eachPassenger: passengerList) {
if
(eachPassenger.getPassengerName().equalsIgnoreCase(newPassengerName))
{
System.out.println("That passenger is already in the system.
Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// get cruise name for passenger
System.out.println("Enter cruise name: ");
String newCruiseName = newPassengerInput.nextLine();
// ensure cruise exists
for (Cruise eachCruise: cruiseList) {
if (eachCruise.getCruiseName().equalsIgnoreCase(newCruiseName))
{
// cruise does exist
} else {
System.out.println("That cruise does not exist in the system.
Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// get room type
System.out.println("Enter Room Type (BAL, OV, STE, or INT:
");
String room = newPassengerInput.nextLine();
// validate room type
if ((room.equalsIgnoreCase("BAL")) || (room.equalsIgnoreCase("OV"))
||
(room.equalsIgnoreCase("STE")) || (room.equalsIgnoreCase("INT")))
{
// validation passed - add passenger
Passenger newPassenger = new Passenger(newPassengerName,
newCruiseName, room.toUpperCase());
passengerList.add(newPassenger);
} else {
System.out.println("Invalid input. Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// Edit an existing passenger
public static void editPassenger() {
// This method does not need to be completed
System.out.println("The \"Edit Passenger\" feature is not yet
implemented.");
}
// Method to check if input is a number
public static boolean isANumber(String str) {
for (int i = 0; i < str.length(); i++) {
if (Character.isDigit(str.charAt(i)) == false)
return false;
}
return true;
}
}
----PASSENGER.JAVA------
public class Passenger {
// Class variables
private String passengerName;
private String passengerCruise;
private String passengerRoomType;
// Constructor - default
Passenger() {
}
// Constructor - full
Passenger(String pName, String pCruise,
String pRoomType) {
passengerName =
pName;
passengerCruise =
pCruise;
passengerRoomType =
pRoomType; // should be BAL, OV, STE, or INT
}
// Accessors
public String getPassengerName() {
return
passengerName;
}
public String getPassengerCruise()
{
return
passengerCruise;
}
public String getPassengerRoomType()
{
return
passengerRoomType;
}
// Mutators
public void setPassengerName(String tVar)
{
passengerName =
tVar;
}
public void setPassengerCruise(String
tVar) {
passengerCruise =
tVar;
}
public void setPassengerRoomType(String
tVar) {
passengerRoomType =
tVar;
}
// print method
public void printPassenger() {
int
spaceCount;
String spaces1 =
"";
String spaces2 =
"";
spaceCount = 20 -
passengerName.length();
for (int i = 1; i
<= spaceCount; i++) {
spaces1
= spaces1 + " ";
}
spaceCount = 20 -
passengerCruise.length();
for (int i = 1; i
<= spaceCount; i++) {
spaces2
= spaces2 + " ";
}
System.out.println(passengerName
+ spaces1 + passengerCruise + spaces2 +
passengerRoomType);
}
// method added to print passenger's
name vice memory address
@Override
public String toString() {
return
passengerName;
}
}
In: Computer Science
•Write a Write a Python script that performs brute force to extract a password protected zip file named sec3.zip. The password is believed to be associated with one of the dictionary words in the 'wordlist.txt file. The password policy enforces that all employees MUST use passwords that include at least one capital and one digit. The files are attached (hint must import zipfile)
In: Computer Science