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
In: Computer Science
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]
Describe the worst case scenario of quick sort [2 Marks]
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. 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 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
In: Computer Science
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 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 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 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 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 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 × 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 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