Questions
In C: You are to create a program to request user input and store the data...

In C:

You are to create a program to request user input and store the data in an array of structures, and then display the data as requested. The data you are collecting refers to a set of images. The images are OCT images taken of the lining of the bladder. The data you provide will help diagnose the image as cancerous or not, but your code does not need to do that at the moment.

1) Define a global structure that contains the following information:

a) File number (must be >0)

b) Diagnosis number (1-8)

c) Number of layers in the image

d) Maximum average intensity of a single row (should be a float)

e) Width of brightest layer

2) Declare an array of 9 of the structures in #1. This array should be a global variable.

3) Initialize each of the file numbers in the array to -1.

4) Create a loop that will continue asking the user for the above data until the file number 0 is given, or until information has been provided for 9 images.

5) If the user provides a file number less than 0, ask again. Do not ask for further information if the user provides a file number equal to 0.

6) If the user provides a diagnosis number that is not between 1 and 8, ask again.

7) Store the data in the array of structures in the order it is provided.

8) Write a function to display the information for a particular file number. If the file number was not found, nothing is displayed. The function will return a 1 if the file number was found or a 0 if the file number was not in the array.

9) In your main function, after the loop which requests the data, create another loop that will request a file number from the user and then call the function written for #8 to display the data for that file number. This loop will continue until a file number is provided that is not found.

10) In your main function, after the code for #9, add a loop that will display the information for all items stored in the array in order.

In: Computer Science

please recode this in c++ language public abstract class BankAccount { double balance; int numOfDeposits; int...

please recode this in c++ language

public abstract class BankAccount
{
double balance;
int numOfDeposits;
int numOfWithdraws;
double interestRate;
double annualInterest;
double monSCharges;
double amount;
double monInterest;

//constructor accepts arguments for balance and annual interest rate
public BankAccount(double bal, double intrRate)
{
balance = bal;
annualInterest = intrRate;
}

//sets amount
public void setAmount(double myAmount)
{
amount = myAmount;
}

//method to add to balance and increment number of deposits
public void deposit(double amountIn)
{
balance = balance + amountIn;
numOfDeposits++;
}

//method to negate from balance and increment number of withdrawals
public void withdraw(double amount)
{
balance = balance - amount;
numOfWithdraws++;
}

//updates balance by calculating monthly interest earned
public double calcInterest()
{
double monRate;

monRate= interestRate / 12;
monInterest = balance * monRate;
balance = balance + monInterest;
return balance;
}

//subtracts services charges calls calcInterest method sets number of withdrawals and deposits
//and service charges to 0
public void monthlyProcess()
{
calcInterest();
numOfWithdraws = 0;
numOfDeposits = 0;
monSCharges = 0;
}

//returns balance
public double getBalance()
{
return balance;
}

//returns deposits
public double getDeposits()
{
return numOfDeposits;
}

//returns withdrawals
public double getWithdraws()
{
return numOfWithdraws;
}
}
and the subclass

public class SavingsAccount extends BankAccount
{
//sends balance and interest rate to BankAccount constructor
public SavingsAccount(double b, double i)
{
super(b, i);
}

//determines if account is active or inactive based on a min acount balance of $25
public boolean isActive()
{
if (balance >= 25)
return true;
return false;
}

//checks if account is active, if it is it uses the superclass version of the method
public void withdraw()
{
if(isActive() == true)
{
super.withdraw(amount);
}
}

//checks if account is active, if it is it uses the superclass version of deposit method
public void deposit()
{
if(isActive() == true)
{
super.deposit(amount);
}
}

//checks number of withdrawals adds service charge
public void monthlyProcess()
{
if(numOfWithdraws > 4)
monSCharges++;
}
}

INSTRUCTIONS WERE:
Build a retirement calculator program using classes ( have sets and gets for classes ) including unit tests for the classes.

Create a class for BankSavings Account -

fixed interest rate ( annual rate ) ( this should be set via a function call )

add money

withdraw money


Class for MoneyInYourPocket

add money

withdraw money


Class for MarketMoney ( investment )

rate of return is a variable 4% +- 6% randomly each time we 'apply it' ( don't need to unit test this for now, wait till next week )

add money

withdraw money ( every time you withdraw money, you get charged a $10 fee )


Build the retirement simulator.

Ask the user how old they are, and what age they want to retire.

For each asset type, get a current balance.

for every year until they retire ( loops ),

apply the return on investment or interest rate.

print the current balance in each type

ask for additional savings or withdrawals ( for each account type )

Once you reach the retirement age, display the balances of each type.

Also, generate a grand total, and adjust it for inflation ( fixed 2% per year )

total / ( 1.02 ^ years )

question has been answered before, so dont know how it doesnt have "enough inputs"

In: Computer Science

Write a suitable scenario for Travel Agent System, draw appropriate use case diagrams, derive the classes...

Write a suitable scenario for Travel Agent System, draw appropriate use case diagrams, derive the classes and objects to design and create the class diagram, sequence diagram and activity diagram.

In: Computer Science

Using an example of 6 integer elements, Show how quick sort can be done. [4 Marks]...

  1. Using an example of 6 integer elements,

    1. Show how quick sort can be done. [4 Marks]

  1. Describe the worst case scenario of quick sort [2 Marks]

  2. In your answer at d (i), show what makes quick sort categorized as divide and conquer

[2 marks]

In: Computer Science

Messages comprising seven different characters, A through G, are to be transmitted over a data link....

Messages comprising seven different characters, A through G, are to be transmitted over a data link. Analysis has shown that the related frequency of occurrence of each character is A 0.10, B 0.25, C 0.05, D 0.32, E 0.01, F 0.07, G 0.2
i) Derive the entropy of the messages
ii) Use static Huffman coding to derive a suitable set of codewords.
iii) Derive the average number of bits per codeword for your codeword set to transmit a message and compare this with both the fixed-length binary and ASCII codewords.

iv) State the prefix property of Huffman Coding and hence show that your codeword set derived in the exercise satisfied this.
v) Derive a flowchart for an algorithm to decode a received bit string encoded using your codeword set.
vi) Give an example of the decoding operation assuming the received bit string comprises a mix of seven characters

In: Computer Science

####################################################################### ##################################### ###############python################# # RQ1 def merge(dict1, dict2): """Merges two Dictionaries. Returns a new dictionary that...

#######################################################################
#####################################
###############python#################

# RQ1
def merge(dict1, dict2):
    """Merges two Dictionaries. Returns a new dictionary that combines both. You may assume all keys are unique.

    >>> new =  merge({1: 'one', 3:'three', 5:'five'}, {2: 'two', 4: 'four'})
    >>> new == {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five'}
    True
    """
    "*** YOUR CODE HERE ***"


# RQ2
def counter(message):
    """ Returns a dictionary where the keys are the words in the message, and each
    key is mapped (has associated value) equal 
    to the number of times the word appears in the message.
    >>> x = counter('to be or not to be')
    >>> x['to']
    2
    >>> x['be']
    2
    >>> x['not']
    1
    >>> y = counter('run forrest run')
    >>> y['run']
    2
    >>> y['forrest']
    1
    """
    "*** YOUR CODE HERE ***"

In: Computer Science

Semester 2019 Java Programming Project 3: Loops, Strings, and Character Methods Having a secure password is...

Semester 2019
Java Programming Project 3: Loops, Strings, and Character Methods


Having a secure password is a very important practice, particularly when much of our personal information is stored online.

Please write a program that validates a new password, following these 4 rules:

The password must be at least 8 characters long.
The password must have at least one upper case letter.
The password must have at least one lower case letter.
The password must have at least one digit.
1) Your program should ask for a password, and then check first to see if the password is valid (i.e., conforms to the specifications outlined above.) If not, the program should allow the user to continue to enter passwords until s/he enters a valid password.

2) Then your program should confirm the password by requesting that the user enter the password again, and verify that the two match. If they don't match, allow the user to try it again (for a total of 3 tries only).

You will need a minimum of two methods, one to confirm the two passwords, and at least one (or more) to check to see if the password meets the 4 required specifications outlined above.

Carefully examine and follow ALL the program requirements. Make sure you use prologue comments for your program, including prologue comments for each of your methods. You will find both the Java String methods as well as the Character Class Methods immensely helpful for this Lab. Please use comments as well for any part of your code that may not be self-explanatory or may require some additional documentation.

You will find both the Java String methods as well as the Character Class Methods immensely helpful for this Lab.

SUBMISSION GUIDELINES:

1) Please write and submit an algorithm (in class) to help you with the design phase of this lab.

2) Submit a hard copy of your Java program (in class).

3) Attach your java program online in the Assignments tool. Go to Assessments-->Assignment --> Java Programming Project 3.

4) Submit a hard copy of program output or output screen shots of your program in action illustrating its functionality. You should show at least 3 program runs.


In: Computer Science

One of your friends has an awful writing style: he almost never starts a message with...

  1. One of your friends has an awful writing style: he almost never starts a message with a capital letter, but adds uppercase letters in random places throughout the message. It makes chatting with him very difficult for you, so you decided to write a plugin that will change each message received from your friend into a more readable form.

Implement a function that will change the very first symbol of the given message to uppercase, and make all the other letters lowercase.

2. Implement a function that will compute the area of a triangle.

In: Computer Science

You have been assigned to a development team that is building software that will be used...

You have been assigned to a development team that is building software that will be used to control the operations of a bicycle rental store. A rental store has a limited number of vehicles that can be managed. A bicycle rental store must maintain information about how many vehicles are available for rental. The bicycle rental store must provide publicly available methods to allow vehicles to be added and removed from it. The rental store should also provide publicly available methods that reports its capacity. An attempt to add or remove the vehicle other than it’s capacity should print the message letting user know that he/she can’t add or delete the vehicle (Hint: use “if” condition to check the number of vehicles. They shouldn’t be more that 5/5 each to add and less than 1 to delete). At the moment there are two distinct types of vehicles: bicycle and quadricycle (four-wheel bicycle). Every vehicle has a company code, a fun name, number of wheels and a rental price. The bicycle has two wheels whereas quadricycle has four. Define the Java classes that are required to implement the functionality that is described above. Be sure to use object-oriented principles in your Java code. Hints • Vehicle class, Bicycle class, Quadricycle class, RentalStore class. • Bicycle class and Quadricycle class inherits extends from Vehicle class • RentalStore class will have methods to show the total number of vehicles, add/delete Bicycle and add/delete Quadricycle • Rental class should have ArrayList • In general every class should have attributes, constructor and it’s methods. • Besides RentalStore class, all other classes should have toString() method . • Create TestClass that have Main() method. Bicycles: company code 0001, a fun name ( your choice), number of wheels : 2 and a rental price 150 company code 0002, a fun name ( your choice), number of wheels : 2 and a rental price 110 company code 0003, a fun name ( your choice), number of wheels : 2 and a rental price 50 company code 0004, a fun name ( your choice), number of wheels : 2 and a rental price 250 company code 0005, a fun name ( your choice), number of wheels : 2 and a rental price 90 quadricycle : company code 0011, a fun name ( your choice), number of wheels : 4 and a rental price 250 company code 0012, a fun name ( your choice), number of wheels : 4 and a rental price 110 company code 0013, a fun name ( your choice), number of wheels : 4 and a rental price 210 company code 0014, a fun name ( your choice), number of wheels : 4 and a rental price 210 company code 0015, a fun name ( your choice), number of wheels : 4 and a rental price 190 For this scenario, we will have 5 bicycles and 5 quadricycles (total of 10 vehicles). Add all those vehicles to an ArrayList. Find bicycles with price less than $100 and delete all of them. Find quadricycles with price less than $200 and delete all of them. At last, show to total number of remaining vehicles with their details.

In: Computer Science

Project Description In this project you will build a car configuration application in six units. Each...

Project Description

In this project you will build a car configuration application in six units. Each unit provides learning opportunities in Object Oriented Design. You are expected to document these lessons and apply them in the next unit. You will notice that the design guidance will taper off as you progress through units in Project 1. You will be expected to design on your own.

Project 1 - Unit 1

In this project you will build a Car Configuration Application using Java. In this unit you will develop a “reference” base object model, read a text file to build the reference base object model and archive it using Serialization.

I would like you to start with a proof of concept – so we will first build the underlying object using normal Java Classes and Inner Classes.

For our proof of concept please consider the following requirements:

We will build Ford's Focus Wagon ZTW model with these options:

  • ● Color - Fort Knox Gold Clearcoat Metallic, Liquid Grey Clearcoat Metallic, Infra-Red Clearcoat, Grabber Green Clearcoat Metallic, Sangria Red Clearcoat Metallic, French Blue Clearcoat Metallic, Twilight Blue Clearcoat Metallic, CD Silver Clearcoat Metallic, Pitch Black Clearcoat, Cloud 9 White Clearcoat

  • ● Transmission - automatic or manual

  • ● Brakes/Traction Control - Standard, ABS, or ABS with Advance Trac

  • ● Side Impact Airbags - present or not present

  • ● Power Moonroof - present or not present
    Configuration options and cost data:

Base Price

$18,445

Color

No additional cost

Transmission

0 for automatic, $­815 for standard (this is a "negative option")

Brakes/Traction Control

$0 for standard, $400 for ABS, $1625 for ABS with Advance Trac

Side Impact Air Bags

$0 for none, $350 if selected

Power Moonroof

$0 for none, $595 if selected

Your Deliverable:

Design and code classes for these requirements and write a driver program to instantiate a Ford Wagon ZTW object and write it to a file. Test your code with a couple of instances of Forward Wagon ZTW.

Use the following driver (or something similar) for testing entire project.

class Driver {

public static void main(String [] args) {

//Build Automobile Object from a file.

Automobile FordZTW = (Some instance method in a class of Util package).readFile("FordZTW.txt");

//Print attributes before serialization

FordZTW.print();

//Serialize the object

Lab1.autoutil.FileIO.serializeAuto(FordZTW);

//Deserialize the object and read it into memory.

Automobile newFordZTW = Lab1.autoutil.FileIO.DeserializeAuto("auto.ser"); //Print new attributes.

newFordZTW.print();

}

}


In: Computer Science

Project Description In this project you will build a car configuration application in six units. Each...

Project Description

In this project you will build a car configuration application in six units. Each unit provides learning opportunities in Object Oriented Design. You are expected to document these lessons and apply them in the next unit. You will notice that the design guidance will taper off as you progress through units in Project 1. You will be expected to design on your own.

Project 1 - Unit 1

In this project you will build a Car Configuration Application using Java. In this unit you will develop a “reference” base object model, read a text file to build the reference base object model and archive it using Serialization.

I would like you to start with a proof of concept – so we will first build the underlying object using normal Java Classes and Inner Classes.

For our proof of concept please consider the following requirements:

We will build Ford's Focus Wagon ZTW model with these options:

  • ● Color - Fort Knox Gold Clearcoat Metallic, Liquid Grey Clearcoat Metallic, Infra-Red Clearcoat, Grabber Green Clearcoat Metallic, Sangria Red Clearcoat Metallic, French Blue Clearcoat Metallic, Twilight Blue Clearcoat Metallic, CD Silver Clearcoat Metallic, Pitch Black Clearcoat, Cloud 9 White Clearcoat

  • ● Transmission - automatic or manual

  • ● Brakes/Traction Control - Standard, ABS, or ABS with Advance Trac

  • ● Side Impact Airbags - present or not present

  • ● Power Moonroof - present or not present
    Configuration options and cost data:

Base Price

$18,445

Color

No additional cost

Transmission

0 for automatic, $­815 for standard (this is a "negative option")

Brakes/Traction Control

$0 for standard, $400 for ABS, $1625 for ABS with Advance Trac

Side Impact Air Bags

$0 for none, $350 if selected

Power Moonroof

$0 for none, $595 if selected

Your Deliverable:

Design and code classes for these requirements and write a driver program to instantiate a Ford Wagon ZTW object and write it to a file. Test your code with a couple of instances of Forward Wagon ZTW.

Use the following driver (or something similar) for testing entire project.

class Driver {

public static void main(String [] args) {

//Build Automobile Object from a file.

Automobile FordZTW = (Some instance method in a class of Util package).readFile("FordZTW.txt");

//Print attributes before serialization

FordZTW.print();

//Serialize the object

Lab1.autoutil.FileIO.serializeAuto(FordZTW);

//Deserialize the object and read it into memory.

Automobile newFordZTW = Lab1.autoutil.FileIO.DeserializeAuto("auto.ser"); //Print new attributes.

newFordZTW.print();

}

}


In: Computer Science

home / study / engineering / computer science / questions and answers / i have a...

home / study / engineering / computer science / questions and answers / i have a c++ question, its already posted on here ... Question: I have a c++ question, its already posted on here ... Bookmark I have a c++ question, its already posted on here but the answer given is way too complex and i dont understand it... its only the first month of c++ so please use the basic code... thank you.

Assume that ax^2 + bx + c = 0. We can now use the quadratic equation to find the value(s) of x. 1. Write a program that generates 3 seeded random integers ranging from -5 to 5 for the values of a, b and c. (You need to seed the random numbers) 2. If a is equal to 0, output “We cannot divide by 0” and do nothing. This is the end of the program. 3. If a is NOT equal to 0, then do the following: 3-1) If b^2– 4ac is positive, then you should output 2 possible values for x based on above equation 3-2) If b^2– 4ac is 0, then you should output 1 value for x. 3-3) Otherwise, you should output “No solution for x” Run the program five times to test. Make sure for each run the value for a, b, c changes.

In: Computer Science

Project Description In this project you will build a car configuration application in six units. Each...

Project Description

In this project you will build a car configuration application in six units. Each unit provides learning opportunities in Object Oriented Design. You are expected to document these lessons and apply them in the next unit. You will notice that the design guidance will taper off as you progress through units in Project 1. You will be expected to design on your own.

Project 1 - Unit 1

In this project you will build a Car Configuration Application using Java. In this unit you will develop a “reference” base object model, read a text file to build the reference base object model and archive it using Serialization.

I would like you to start with a proof of concept – so we will first build the underlying object using normal Java Classes and Inner Classes.

For our proof of concept please consider the following requirements:

We will build Ford's Focus Wagon ZTW model with these options:

  • ● Color - Fort Knox Gold Clearcoat Metallic, Liquid Grey Clearcoat Metallic, Infra-Red Clearcoat, Grabber Green Clearcoat Metallic, Sangria Red Clearcoat Metallic, French Blue Clearcoat Metallic, Twilight Blue Clearcoat Metallic, CD Silver Clearcoat Metallic, Pitch Black Clearcoat, Cloud 9 White Clearcoat

  • ● Transmission - automatic or manual

  • ● Brakes/Traction Control - Standard, ABS, or ABS with Advance Trac

  • ● Side Impact Airbags - present or not present

  • ● Power Moonroof - present or not present
    Configuration options and cost data:

Base Price

$18,445

Color

No additional cost

Transmission

0 for automatic, $­815 for standard (this is a "negative option")

Brakes/Traction Control

$0 for standard, $400 for ABS, $1625 for ABS with Advance Trac

Side Impact Air Bags

$0 for none, $350 if selected

Power Moonroof

$0 for none, $595 if selected

Your Deliverable:

Design and code classes for these requirements and write a driver program to instantiate a Ford Wagon ZTW object and write it to a file. Test your code with a couple of instances of Forward Wagon ZTW.

Use the following driver (or something similar) for testing entire project.

class Driver {

public static void main(String [] args) {

//Build Automobile Object from a file.

Automobile FordZTW = (Some instance method in a class of Util package).readFile("FordZTW.txt");

//Print attributes before serialization

FordZTW.print();

//Serialize the object

Lab1.autoutil.FileIO.serializeAuto(FordZTW);

//Deserialize the object and read it into memory.

Automobile newFordZTW = Lab1.autoutil.FileIO.DeserializeAuto("auto.ser"); //Print new attributes.

newFordZTW.print();

}

}


In: Computer Science

• In this script, write MATLAB code to create an array A of size 100 ×...

• In this script, write MATLAB code to create an array A of size 100 × 3. The first column should contain random numbers between 0 and 10. The second column should also contain random numbers between 0 and 10. The third column should contain random integers between 20 and 50. The first two columns represent the x and y coordinates of a map, respectively. The third column represents the height of buildings. For example, if the first row of A is equal to [3.4 4.5 28], this means that there is a building of height 28 at location (3.4, 4.5) in the map. Because array A has 100 rows, there will be 100 buildings located at random points in the map. • Then, save array A in a file using the MATLAB function save. You may select the name of the file yourselves. • Then, plot the first column of array A vs the second column of array A, using ‘*’ (i.e., the points will be plotted as stars) so that you can see the 100 locations of the buildings. • Finally, after you save the array, clear all variables by placing a clear all at the end of the MATLAB script. • In this script, write MATLAB code to first read the file that you saved in Part A. To read the file, use the MATLAB function load. After you read the file, array A should again become available to you. • Then, write code to move the data from array A to a cell array C of size 10 × 10 in the following way: ◦ The element C{1,1} in C should be an array containing all building heights with x coordinates between 0 and 1 AND y coordinates between 0 and 1. ◦ The element C{2,1} in C should be an array containing all building heights with x coordinates between 1 and 2 AND y coordinates between 0 and 1. ◦ The element C{1,2} in C should be an array containing all building heights with x coordinates between 0 and 1 AND y coordinates between 1 and 2. ◦ The element C{2,2} in C should be an array containing all building heights with x coordinates between 1 and 2 AND y coordinates between 1 and 2. ◦ The element C{3,2} in C should be an array containing all building heights with x coordinates between 2 and 3 AND y coordinates between 1 and 2.

In: Computer Science

QUESTION 2 You are developing an online quiz web application and you have been asked to...

QUESTION 2 You are developing an online quiz web application and you have been asked to design a JSON file for creating a TestBank. You need to design the JSON file for storing some multiple choice questions/answers. Here is an example of sample data which you need to convert it into JSON Q) 5 + 7 * 2 = ? a) 14 b) 12 c) 24 d) 19 ANS: d Answer the following questions: 1) How do you design the JSON file? Create the JSON file (for 5 sample test-questions) and validate it. 2) Develop a jQuery program which displays all questions, their multiple options, and the right answer.

In: Computer Science