Discuss whether the spiral model is appropriate for each of the following software projects or not. If not, suggest a better model and provide justifications for your choice.
Project 1: a software team were asked to develop a large-scale human resource software. The project manager identified several major technical risks that need to be mitigated.
Project 2: a software team were asked to develop a small web application for older people to help them apply for health insurance. The team are not sure about how to make it easy for older people to interact with the application.
In: Computer Science
Q1 / Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.
Q2 / Sometimes, segmentation and paging are joint into one scheme. Why, explain in your words.
In: Computer Science
I need convert this java code to C language. There is no string can be used in C. Thank you!
import java.util.Scanner;
public class Nthword
{
public static void main( String args[] )
{
String line;
int word;
Scanner stdin = new Scanner(System.in);
while ( stdin.hasNextLine() )
{
line = stdin.nextLine();
word = stdin.nextInt(); stdin.nextLine(); // get rid of the newline
after the int
System.out.println( "Read line: \"" + line + "\", extracting
word [" + word + "]" );
System.out.println( "Word #" + word + " is: " + extractWord( line,
word ) );
}
stdin.close();
System.out.println( "\nEnd of processing" );
}
// returns the first word of the string
private static String extractWord( String theLine, int word )
{
int start;
int end;
int spaces = 1;
String result = "";
// search for the nth non-blank character
for (start = 0; start < theLine.length() && spaces <
word; start++)
{
if ( Character.isSpaceChar( theLine.charAt( start ) ) )
{
spaces++;
}
}
// only need to continue if we haven't gone past the end of the
string
if ( start<theLine.length() )
{
// the next blank character is the end
for ( end=start ; end<theLine.length() &&
!Character.isSpaceChar( theLine.charAt( end ) ) ; end++ )
;
// we now have the word
result = theLine.substring( start, end );
}
return( result );
}
}
In: Computer Science
2) Explain the difference between TREE-SEARCH and GRAPH-SEARCH. Support your answer with an example.
In: Computer Science
The Power of Unified Communications
Chapter 7 highlights the power of the "Network." Advances in networking technology have made the internet possible and have provided the underpinning for a revolution in communications. The Macy's RFID (radio frequency identification) case study at the beginning of the chapter highlights the power of wireless networking in particular. As defined by the text, Unified Communications allows companies to merge disparate modes of communication into a single service. This is akin to the technology that underpins the "triple play" packages offered by cable and telecommunications providers alike which combines video, internet, and phone in one package.
By doing a search of the internet or by other research methods, find an example, or a case study, of an organization that has used Unified Communications to their advantage.
Ponder these questions:
1) What business problem was this organization trying to solve?
2) What was the current state of their communications technology infrastructure?
3) What unified communications technologies did they decide to deploy? What were the key components of this system?
4) How did they improve their business by implementing unified communications?
5) What do you believe the future holds for unified communications?
In: Computer Science
In: Computer Science
Create a table of all three of these trigonometric functions for angles from 0 to 2p, with a spacing of 0.1 radian. Your table should contain a column for the angle and then for the sine, cosine, and tangent. ((python))
In: Computer Science
I am working on a project for my Computer Science course. I am trying to create a Battleship game where a user names two coordinates on a grid and is then told whether this results in a "Hit" or a "Miss". Once the ship has been hit a certain number of times (based on the size of the ship) the ship is sunk. I have written all the code but it now fails to execute when I try to run it. Could someone please help me to get this program working properly? I will paste the code below:
battleship.h:
#ifndef BATTLESHIP_H_
#define BATTLESHIP_H_
// coordinates (location) of the ship and shots
class location {
public:
void locationreset(void); // void constructor, assigns -1 to
X
void pick(void); // picks a random location
void fire(void); // asks the user to input the
// coordinates of the next shot
void print(void) const; // prints location in format "a1"
// returns true if the two locations match
friend bool compare(location, location);
private:
static const int fieldSize = 5; // the field (ocean) is fieldSize X
fieldSize
int x; // 1 through fieldSize
char y; // 'a' through fieldSize
};
// contains ship's coordinates (location) and whether is was
sunk
class ship {
public:
ship(void); // void constructor, sets sunk=false
bool match(location) const; // returns true if this location
matches
// the ship's location
bool isSunk(void) const { return(sunk); }; // checks to see if the
ship is sunk
void sink(void); // sets "sunk" member variable of the ship to
true
void setLocation(location); // deploys the ship at the specified
location
void printShip(void) const; // prints location and status of the
ship
private:
location loc;
bool sunk;
};
// contains the fleet of the deployed ships
class fleet {
public:
void deployFleet(void); // deploys the ships in random
locations
// of the ocean
bool operational(void) const; // returns true if at least
// one ship in the fleet is not sunk
bool isHitNSink(location); // returns true if there was a
deployed
// ship at this location (hit) and sinks it
// otherwise returns false (miss)
void printFleet(void) const; // prints out locations of ships in
fleet
private:
static const int fleetSize = 5; // number of battleships
bool check(location); // returns true if one of the ship's
locations
// matches the ship, returns false
// if none-match
ship ships[fleetSize]; // battleships of the fleet
};
#endif /* BATTLESHIP_H_ */
//////////////////////////////////////////////////////////////////////////////////////////////////////////
battleship.cpp:
#include <iostream>
#include <ctime>
#include <cstdlib>
#include "battleship.h"
using namespace std;
void location::locationreset(void) {
x = -1;
y = 'x';
}
void location::pick(void) {
x = rand() % fieldSize + 1;
y = rand() % fieldSize;
switch (y) {
case 0: y = 'a'; break;
case 1: y = 'b'; break;
case 2: y = 'c'; break;
case 3: y = 'd'; break;
case 4: y = 'e'; break;
}
}
void location::fire(void) {
cout << "input the coordinates of the next shot
"; cin >> y >> x;
}
void location::print() const {
cout << y << x;
}
bool compare(location loc1, location loc2) {
return (loc1.x == loc2.x && loc1.y ==
loc2.y);
}
ship::ship(void) {
sunk = false;
}
bool ship::match(location shiploc) const {
return compare(loc, shiploc);
}
void ship::sink(void) {
sunk = true;
}
void ship::setLocation(location shiploc) { //
deploys the ship at the specified location
loc = shiploc;
}
void ship::printShip(void) const { // prints location and status
of the ship
loc.print();
if (sunk == true)
cout << "sunk";
else if (sunk == false)
cout << "not sunk" <<
endl;
}
void fleet::deployFleet(void) { // deploys the ships in random
locations of the ocean
location loc; loc.locationreset();
for (int i = 0; i < fleetSize; i++) {
loc.pick();
ships[i].setLocation(loc);
}
}
bool fleet::operational() const { // returns true if at least
one ship in the fleet is not sunk
for (int i = 0; i < fleetSize; ++i)
if (ships[i].isSunk() ==
false)
return
true;
return false;
}
bool fleet::isHitNSink(location shiploc) { //
returns true if there was a deployed
for (int i = 0; i < fleetSize; ++i) {
if (ships[i].match(shiploc) == true
&& ships[i].isSunk() == false)
{
ships[i].sink();
return
true;
}
else
return
false;
}
}
void fleet::printFleet(void) const { // prints out locations of
ships in fleet
for (int i = 0; i < fleetSize; ++i)
ships[i].printShip();
}
bool fleet::check(location shiploc) {
for (int i = 0; i < fleetSize; ++i)
if (ships[i].match(shiploc))
{
return
true;
}
else
{
return
false;
}
}
////////////////////////////////////////////////////////////////////////////
main.cpp:
#include "battleship.h"
#include <iostream>
using namespace std;
int main() {
srand(time(NULL));
char answer;
fleet myFleet; //computer's ships
myFleet.deployFleet(); // fleet is deployed at random
locations
cout << "Do ships' positions and status need to
be printed? (y for yes)" << endl;
cin >> answer;
if (answer == 'y')
myFleet.printFleet();
while (myFleet.operational() == true) {
cout << "there are still
ships up";
location userShot;
userShot.locationreset();
cout << "Input location(a-e
1-5): ";
userShot.fire();
if (myFleet.isHitNSink(userShot) ==
true)
cout <<
"hit";
else
cout <<
"miss";
cout << "Do ships' positions
and status need to be printed? (y for yes, q to quit)";
cin >> answer;
if (answer == 'y')
myFleet.printFleet();
else if (answer == 'q')
break;
}
}
In: Computer Science
given an array A = {a1, a2, ... ,
an}
find the number of the continuous subarrays of gcd one
continuous subarrays of gcd one means gcd(ai,
ai+1, ... , aj) = 1
for example {2, 4, 6, 3} or {1} are continuous subarrays of gcd
one
In: Computer Science
Need this in C++:
Suppose that you are given a set of words; and two words from the set: word 1 and word 2.
Write a program which will transform word 1 into word 2 by changing a single letter in word 1 at a time.
Every transition that word 1 takes will have to be in the set of words.
You must output the smallest sequence of transitions possible to convert word 1 into word 2.
You may assume that all the words in the dictionary are the same length.
The first line will be word 1 and word 2 separated by a comma, followed by the set of words. The set of words will be terminated by a ‘-1’.
Input:
DOG,GOD
DOG
BOG
GOG
ABH
GOD
THU
IOP
-1
Output:
DOG -> GOG -> GOD
Input:
HOUSE,JOUKS
MOUSE
HIUKE
HIUKS
HOUSH
LOUSE
HOZKS
SOUSE
HOUKS
HOUSE
HOUKE
JOUKZ
JOUKS
HOIKE
-1
Output:
HOUSE -> HOUKE -> HOUKS -> JOUKS
In: Computer Science
In Ruby
A dentist appointment schedule validation software
Implement a superclass Appointment and sub classes OneTime, Day and Month. An appointment has a description (for example, "Root Canal"), and dates information (you can use Date object or int Year, Int Month, Int Day). Fill an array of Appointment objects with a mixture of appointments.
Write a method OccursOn inside each of the sub classes that checks whether the appointment occurs on that date (OneTime), day (Day) or month (Month). Ask the user to enter a date to check (for example, 2006 10 5), and ask to user if they want to check against OneTime, Day or Month appointment. Based on what the user selected, OccursOn inside each of the sub class should run and display any matching appointment and associated descriptions.
Hint: For OneTime subclass, OccursOn need three inputs (Year, Month and Day) to validate, for Day subclass, OccursOn needs one input (Day) to validate, and for Month subclass, OccursOn need one input (Month) to validate. OccursOn is different for different subclasses.
In: Computer Science
Calculator Class Instructions
Create a calculator class that will add, subtract, multiply, and divide two numbers. It will have a method that will accept three arguments consisting of a string and two numbers example ("+", 4, 5) where the string is the operator and the numbers are what will be used in the calculation.
The class must check for a correct operator (+,*,-,/), and a number (integer) for the second and third argument entered. The calculator cannot divide by zero that will be an error.
Separate error messages will be displayed for all errors. Also, separate success messages will be displayed with each successful answer. This script will run using a browser. The output of the script will display after the web address is entered into the browser navigation window. There will be a separate file that will require the class. That file will be used to instantiate the class and call the appropriate method, while the class will do the heavy lifting.
You will have two files
One will be the file that is your class.
The other will be a file that requires your class and call the
appropriate method. This is the file you will provide the web
address for.
For example:
If you have a file with a class named $Calculator. You will have another class that uses the calculator class and displays the information. That file will have the code shown below.
NOTE: You are to use the code shown below as your test code.
NOTE: For this assignment you can write the following code within a PHP block within the HTML body element. You do not need to write the comments I did that to show you what needs to be outputted depending on what is sent as arguments.
<?php
require_once "Calculator.php";
$Calculator = new Calculator();
echo $Calculator->calc("/", 10, 0); //will output Cannot divide
by zero
echo $Calculator->calc("*", 10, 2); //will output The product of
the numbers is 20
echo $Calculator->calc("/", 10, 2); //will output The division
of the numbers is 5
echo $Calculator->calc("-", 10, 2); //will output The difference
of the numbers is 8 echo $Calculator->calc("+", 10, 2); //will
output The sum of the numbers is 12
echo $Calculator->calc("*", 10); //will output You must enter a
string and two numbers echo $Calculator->calc(10); //will output
You must enter a string and two numbers
?>
The browser will output (based upon the above methods):
Cannot divide by zero
The product of the numbers is 20
The division of the numbers is 5
The difference of the numbers is 8
The sum of the numbers is 12
You must enter a string and two numbers You must enter a string and
two numbers
in PHP/HTML
In: Computer Science
How would you call a username in a different function when coding in C?
I have a function that logs a user in, and I would like to say if (username == 'abc'){do function} but everytime I use the 'username' variable in a different function, it says it is an undeclared identifier.
In: Computer Science
User Python to solve; show all code:
Write a program that will prompt the user for the player data described above. The user does not know how many players are on the team so allow the user to enter the word end when he/she has finished entering data.
Validate that the player is not entered more than once.
After entering the data, compute the following:
In: Computer Science
Java Special Methods:
A) Write a method that finds the maximum of two numbers. You should not use if-else or any other comparison operator.
B) Write methods to implement the multiply, subtract and divide operations for integers. The results of all of these are integers. Use only the add operator.
In: Computer Science