1-Using the Note class and make it Comparable. A Note is larger than another note if it is higher in frequency. 2-In the driver program create a few objects and compare them . then create a list of those objects and sort them. 3. Rewrite the Note class so that a list of Notes is sorted first by length of note, then within that by frequency.
import java.io.*;
import java.math.*;
public class NoteTester
{
public static void main(String[] args) throws IOException
{
//Declare variables to hold user input
double noteValue;
String noteLength;
int tempLength;
//Create BufferedReader object wrapped with InputStreamReader to hold user input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//Retrieve starting value from user
System.out.println("Please enter a value for your note\n"+
"between -48 and 39:");
noteValue = Double.parseDouble(br.readLine());
//While loop ensures a valid number
while(noteValue < -48 || noteValue > 39)
{
System.out.println("Please enter a valid value for your note\n"+
"between -48 and 39:");
noteValue = Double.parseDouble(br.readLine());
}
//Retrieve starting length from user
System.out.println("Please enter the number between 1-5\n" +
"you would like to represent\n" +
"the length of your note.\n"+
"1. Whole\n" +
"2. Half\n" +
"3. Quarter\n" +
"4. Eighth\n" +
"5. Sixteenth");
tempLength = Integer.parseInt(br.readLine());
//While loop ensures a valid length
while(tempLength > 5 || tempLength < 1)
{
System.out.println("Please enter the number between 1-5\n" +
"you would like to represent\n" +
"the length of your note.\n"+
"1. Whole\n" +
"2. Half\n" +
"3. Quarter\n" +
"4. Eighth\n" +
"5. Sixteenth");
tempLength = Integer.parseInt(br.readLine());
}
//If else statement assigns strings to the user's choice of int
if(tempLength == 1)
{
noteLength = "whole";
}
else if(tempLength == 2)
{
noteLength = "half";
}
else if(tempLength == 3)
{
noteLength = "quarter";
}
else if(tempLength == 4)
{
noteLength = "eighth";
}
else if(tempLength == 5)
{
noteLength = "sixteenth";
}
else
{
noteLength = "Invalid";
}
//Create demoNote object
Note demoNote = new Note(noteValue, noteLength);
//Print user the information about their note
System.out.print("Your value was " + demoNote.getValue() + ", your length was a(n) " + demoNote.getLength()
+ " note, your note's \nletter value was " + demoNote.getLetter() + " which is a " +
demoNote.getSharp() + " note. \nThe frequency of your" +
" note is " + demoNote.getFreq() + " hz." );
}
}
class Note
{
/*Declare variables privately so they cannot be accessed from outside the class. Set the value default
to middle C and the length default to quarter.*/
private double value = 0;
private String length = "Quarter";
private String letter;
private String sharp;
private double freq;
/**
* Constructor
* @param value the note's starting value
* @param length the note's starting length
*/
public Note(double value, String length)
{
this.value = value;
this.length = length;
}
//Setters
//Assigns this.value to variable value
void setValue(double value)
{
this.value = value;
}
//Assigns this.length to variable length
void setLength(String x)
{
this.length = length;
}
//Getters
//@return The value of the note
public double getValue()
{
return value;
}
//@return The length of the note
public String getLength()
{
return length;
}
//@return The letter of the chromatic scale the value is assigned to
public String getLetter()
{
if(value == 0 || value == 12 || value == 24 || value == 36 ||
value == -12 || value == -24 || value == -36 || value == -48)
{
letter = "A";
}
else if(value == 1 || value == 13 || value == 25 || value == 37 ||
value == -11 || value == -23 || value == -35 || value == -47)
{
letter = "A#";
}
else if(value == 2 || value == 14 || value == 26 || value == 38 ||
value == -10 || value == -22 || value == -34 || value == -46)
{
letter = "B";
}
else if(value == 3 || value == 15 || value == 27 || value == 39 ||
value == -9 || value == -21 || value == -33 || value == -45)
{
letter = "C";
}
else if(value == 4 || value == 16 || value == 28 || value == -8 ||
value == -20 || value == -32 || value == -44)
{
letter = "C#";
}
else if(value == 5 || value == 17 || value == 29 || value == -7 ||
value == -19 || value == -31 || value == -43)
{
letter = "D";
}
else if(value == 6 || value == 18 || value == 30 || value == -6 ||
value == -18 || value == -30 || value == -42)
{
letter = "D#";
}
else if(value == 7 || value == 19 || value == 31 || value == -5 ||
value == -17 || value == -29 || value == -41)
{
letter = "E";
}
else if(value == 8 || value == 20 || value == 32 || value == -4 ||
value == -16 || value == -28 || value == -40)
{
letter = "F";
}
else if(value == 9 || value == 21 || value == 33 || value == -3 ||
value == -15 || value == -27 || value == - 39)
{
letter = "F#";
}
else if(value == 10 || value == 22 || value == 34 || value == -2 ||
value == -14 || value == -26 || value == -38)
{
letter = "G";
}
else if(value == 11 || value == 23 || value == 35 || value == -1 ||
value == -13 || value == -25 || value == -36)
{
letter = "G#";
}
else
{
letter = "invalid";
}
return letter;
}
//@return Whether or not the note is sharp
public String getSharp()
{
if(value == 1 || value == 13 || value == 25 || value == 37 ||
value == -11 || value == -23 || value == -35 || value == -47 ||
value == 4 || value == 16 || value == 28 || value == -8 ||
value == -20 || value == -32 || value == -44 ||
value == 6 || value == 18 || value == 30 || value == -6 ||
value == -18 || value == -30 || value == -42 ||
value == 9 || value == 21 || value == 33 || value == -3 ||
value == -15 || value == -27 || value == - 39 ||
value == 11 || value == 23 || value == 35 || value == -1 ||
value == -13 || value == -25 || value == -36)
{
sharp = "sharp";
}
else
{
sharp = "natural";
}
return sharp;
}
//@return The frequency of the note
public double getFreq()
{
freq = (440 * Math.pow(2, value / 12));
return freq;
}
}In: Computer Science
The UA record app can provide personalised advices to a specific user by collecting and analysing personal data. Please list one example for each of the following data types, categorical, ordinal and numerical, in the context of the case study. [5 marks]
2. The UA Record app collects the data from a lot of users, and thereby the backend system can do trend analysis over these data. However, the data could be collected through different versions of different devices and apps, in different countries, at real time by sensors or manually. What kind of data quality issues do you think there could exist? Please list at least three different data quality issues and briefly explain them. [5 marks]
In: Computer Science
Discuss how you would set up control measures in your organization or even your home? What considerations must you include in your risk analysis? How do those differ when analyzing risk for hardware, software, and cloud services?
In: Computer Science
Situation (Data Structures and Sorting C++)
You have been employed at BmoCel, an internet service provider.
Data is sent as packets from their
server to their clients. Each packet has a fixed size of 16
alphanumeric characters. However, they are
currently having problems with managing their data transmissions.
Your bosses have asked you to
rectify the problem
The client manages the packets in a First‐In, First‐Out manner. Due to transmission limitations of the client, only 8 packets can be transmitted in the transmission pipeline at any given time. If another packet is to be transmitted, the first packet that was transmitted will be stored onto the client, making room for additional packets in the transmission pipeline.
Data File -
0OX0j0JWgaRhCGrR
0jEP1Rlm8pMgtiEI
1CuwzEe5WEOZaX7y
1R0AgNFSM0RsBqDM
1UqYsbTzHq0PoY4q
1VhN3v4ety9cLS8i
1Z6fJ5tPCJFnYBrc
1jhdHIZXo0D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xrVWn8hkSoPXpB3
l32EOzFpfeZZXbBK
lJXS3hWyfQeeQtmB
lUoloXi15VFfj7w9
lZRiXNgR0mcYOGXS
ldbWPp0JGQxeX39J
ln90eblkkL65rGzh
lx8EyuG2U572pUnu
m7zoxvEAp0pAGk1k
mVFaJ6KSS7cjmi8a
mY3mN7JQfsOsaYvT
mgS6x2NDkM3BOymT
mwpyFc54kXRdeh12
n4fMBgqwMEBUqRrB
nHJi5CH6WUJhbm5Q
nnf46cAu5nqV8GjG
oMkJSS6Ei1KdX6JE
omyeKucr7kR3NqGT
osD27IzZL8wn9SAB
p0JtExSt1kbAr2d7
p9d8HYex6RcPL4PL
pJ7Bkmk1rW8Sh4DQ
pSgW91LMenX96a2x
pczX62VoOtCpNUVQ
q2TAe7f1ZJ9BRIRn
qUi1VlH1REZBEE4V
qkCy3GMSus9C9FHV
qkvFn18olwy0PG5P
r6wIM4hFMI9aNTMi
s2cRVI3KxhucKCli
s8zs2pOil3XTHGux
sVqqCX1UyQYmT632
sa16ujcUUVsDu8gp
sgu5LieeSuQVQWez
syXK7aMfCdiG6nm5
tAesshWoUU5YiBZ7
ubN0HFJiq65xBJpn
ucvUn9r9etM6ABe8
uhAhcjYLmnbC417z
uhPZlr95rkTv4iIo
vDYsShVEttXXZ958
vIflDDkagc2POMpt
vOarRqdc2jggQM9T
vajdHennHjreO0P8
vvVH6Wn1FoHY8ptS
w5Lmc0yvajgUgxGq
wDXh4i9fqunjRVHT
weffNiLu9h6TtzJw
wsYARWi5SWifELmA
xqYSrQHQkk89bl6t
xwqgA7BC3fwGgIGG
y0FZKmkCEl7paaVP
yJs4KG3jovxppzZI
yL7f01uwkZXcMZdI
yLjdpyOBdhM9tSQz
yw3WDQbeSkk5Cu2A
yy7ZuOAnTkjkmStU
z0okwHZXCJQLpbxn
zXHrwXca5XKzFuLc
zkvwe94xoV58JRyk
zuCqRmtzhcwiXJ1U
In: Computer Science
To create a home budget, you want to find out your net income,
which is your income minus your expenses.
Write a Java method that takes an input string and computes the
income minus the expenses.
The income components are indicated by numbers; while the expenses
from your spending are numbers starting with a minus sign
'-'.
The input string may contain lowercase and uppercase letters, as
well as other characters.
Note that Character.isDigit(char) tests if a char is one of the
chars '0', '1', ..., '9'. Also recall that Integer.parseInt(string)
converts a string to an int.
Test cases :
calcNetIncome("salary 15000yuan bonus2000 rent -1000Y") →
16000
calcNetIncome("25000 gross income, -200 water, electricity:-300") →
24500
In: Computer Science
Explain equalization,neutralization,proportioning and volume reduction with examples and in details.(50marks)
Need own answer and no internet answers r else i il downvote nd report to chegg.Even a single is wrong i il downvote.its 50marks question so no short answer minimum 10page answer required and own answer r else i il downvote.
Note:Minimum 10page answer and no plagarism r else i il downvote and report to chegg.Minimum 10 to 15page answer required r else dnt attempt.strictly no internet answer n no plagarism.
its 50marks question so i il stricly review nd report
In: Computer Science
With respect to a general multitasking system
What mechanism allows operating system routines to get more control of the CPU than user tasks?
What are the two states a task can be in while waiting for control of the CPU?
In: Computer Science
Exercise3
Given the following classes:
The Holiday class has:
The TravelAgent class has:
(RunTravelAgent.java
public class RunTravelAgent
{
public static void main(String[] args)
{
Holiday h1 = new Holiday("Bermuda", 2, 800);
Holiday h2 = new Holiday("Hull", 14, 8);
Holiday h3 = new Holiday("Los Angeles", 12, 2100);
TravelAgent t1 = new TravelAgent("CheapAsChips", "MA99 1CU");
t1.addHoliday(h1);
t1.addHoliday(h2);
t1.addHoliday(h3);
TravelAgent t2 = new TravelAgent("Shoe String Tours", "CO33 2DX");
System.out.println(t1);
System.out.printf("h3 Duration=%s days & Cost=$%s\n", h3.getDuration(), h3.getCost());
System.out.printf("t2 %s %s\n", t2.getName(), t2.getPostcode());
}
}
)
Implement these two classes. You are supplied with a test file called RunTravelAgent.java which should produce this output:
CheapAsChips at MA99 1CU
Holiday{destination=Bermuda, duration=2 days, cost=$800}
Holiday{destination=Hull, duration=14 days, cost=$8}
Holiday{destination=Los Angeles, duration=12 days, cost=$2100}
h3 Duration=$12 & Cost =$2100
t2 Shoe String Tours CO33 2DX
In: Computer Science
Two players find themselves in a legal battle over a patent. The patent is worth 20 for each player, so the winner would receive 20 and the loser 0. Given the norms of the country they are in, it is common to bribe the judge of a case. Each player can secretly oer a bribe of 0, 9 or 20, and the one whose bribe is the largest is awarded the patent. If both choose not to bribe, or if the bribes are the same amount, then each has an equal chance of being awarded the patent. (If a player decides to bribe then the judge pockets it regardless of who gets the patent).
(a) Derive the game matrix.
(b) Is the game dominance solvable? If so, findnd the strategy prole surviving IDSDS.
(c) Now consider the case in which the allowed bribe amounts are instead 0, 9 and 15. Is the game dominance solvable? Find the best responses of each player to each of the pure strategies of the opponent.
In: Computer Science
(Can you answer my question by explaining, I mean that step by step. I don't want a short answer. Be sure to I like it if you write step by step
For Design and Analysis of the Algorithme lecture)
Peak Finding
Implement the 2-D peak finder mentioned and explain the asymptotic complexity of the algorithm.
In: Computer Science
Write a java program to read a string from the keyboard, and count number of digits, letters, and whitespaces on the entered string. You should name this project as Lab5B.
This program asks user to enter string which contains following characters: letters or digits, or whitespaces. The length of the string should be more than 8. You should use nextLine() method to read string from keyboard.
You need to extract each character, and check whether the character is a letter or digit or whitespace.
You can access character at a specific index using charAt() method. Once you have extracted the character, you can test the extracted character using character test methods.
You can look at google/web search to check the methods (isDigit, isLetter, and isSpaceChar) available to test a character. Use the syntax properly in your code.
Once you found a match, simply increase the value of the counter by 1. You need 3
separate counters to count letters, digits, and spaces.
In this program, you do not need to worry about uppercase or lowercase letter.
Sample Output 1
Enter the string: EEEEEEE RRR LLLLLL UUUUUUUUUU Number of spaces: 3 Number of letters: 26 Number of digits: 0
In: Computer Science
# Finds and returns only the even elements in the list u.
# find_evens([1, 2, 3, 4] returns [2, 4]
# find_evens([1, 2, 3, 4, 5, 6, 7, 8, 9, 10] returns [2, 4, 6, 8, 10]
#
u = [1, 2, 3, 4]
v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
def find_evens(u):
return None # Replace this with your implementation
print('Testing find_evens')
print(' find_evens(u): ' + str(find_evens(u)))
print(' find_evens(v): ' + str(find_evens(v)))
print()
Making code using recursion function
In Python
In: Computer Science
explain industrial wastewater treatment,strength reduction,suggested treatment methods and with diagram.(50marks)
Need own answer and no internet answers r else i il downvote nd report to chegg.Even a single is wrong i il downvote.its 50marks question so no short answer minimum 10page answer required and own answer r else i il downvote.
Note:Minimum 10page answer and no plagarism r else i il downvote and report to chegg.Minimum 10 to 15page answer required r else dnt attempt.strictly no internet answer n no plagarism.
its 50marks question so i il stricly review nd report
In: Computer Science
Paula and Danny want to plant evergreen trees along the back side of their yard. They do not want to have an excessive number of trees. Write a program that prompts the user to input the following:
The length of the yard.
The radius of a fully grown tree.
The required space between fully grown trees.
The program outputs the number of trees that can be planted in the yard and the total space that will be occupied by the fully grown trees.
In: Computer Science
1.What are the THREE (3) types of CSS?
a) Internal, External and Online Style Sheets
b) Embedded, Outsider and Inline Style Sheets
c) Embedded, Linking and Inline Style Sheets
2. The width, src and border are examples of an ______. *
a) entity
b) element
c) attribute
d) operation
d) Internal, External and Inline Style Sheets
3. Which of the following codes best represents inserting image from folder named images?
a) <p>Image:</p> <img src="/chrome/images.gif" alt="Google Chrome" width="33" height="32" />
b) <p>Image:</p><img src="file://images/chrome.gif" alt="Google Chrome" width="33" height="32" />
c) <p>Image:</p><img src="/images/chrome.gif" alt="Google Chrome" width="33" height="32" />
d) <p>Image:</p><img src="folder: images image file name: chrome.gif" alt="Google Chrome" width="33" height="32" />
4.Which of the following is the CORRECT HTML tag to start JavaScript?
a) <script>
b) <js>
c) <javascript>
d) <scripting>
5. How can you add a comment in JavaScript? *
a) <!--This is a comment-->
b) //This is a comment
c) "This is a comment"
d) <--! This is a comment -->
6. Select the correct HTML statement in referring to an external style sheet.
a) <link rel="stylesheet" type="text/css" href="mystyle.css">
b) <stylesheet>mystyle.css</stylesheet>
c) <style src="mystyle.css">
d) <link rel=”style" type="text/css" href="mystyle.css">
In: Computer Science