1.Create a standard Java project (i.e. not a JavaFX project) in NetBeans called Personsages
2.Declare a Scanner variable called keyboardInput and a variable called personAge as type int. Code the statement to read in an integer with a prompt to "Enter your age as an integer:".
3.Code an "if/else if" (also called a multi-way if) block to output the following text based on age ranges personAge might contain:
4.Code an "if / else" statement to determine if the age entered in Step 9 is on/before the year 1990 or after 1990 outputting the message that the person was born on/before or after 1990.
5.Declare a String variable called aCityInNY and read in a String from the keyboard with a prompt "Enter Albany, Buffalo, New York, Rochester, or Binghampton to see its population:".
6.Code a switch block to compare the value input to the cities just mentioned. Output "Population is: " with the population of each city (you are not being tested on the actual population). If the user enters any other city or text, output an appropriate error message to the user.
7.Declare an integer variable called intInput and assign it a 0. Declare a Boolean called keepLooping and set to true. Code a while loop with keepLooping as the condition.
8.In the body of the while loop, code a prompt that says “Input a number – enter 999 to exit:”. Use a Scanner method to get an integer from the keyboard and assign it to intInput. Output the number only if it does not equal 999, else set keepLooping false.
9.Declare a variable called loopInt. Code a for loop that uses loopInt and counts from 0 to 9.
10.In the for loop body, output “For Loop Counter = “ + loopInt.
11.After the for loop, set the loopInt variable to 0. Code a do-while loop that ends after loopInt is 9.
12.In the body of the do-while, output “Do-While Loop Counter = “ + loopInt. Code a statement to increase loopInt by 1.
13.After the while loop, declare an int variable called
loopIntInner and an int variable called loopIntOuter. Code a for
loop that counts loopIntOuter from 0 to 4. This is the outer loop.
In the body, code another for loop (this is the inner loop) that
counts loopIntInner from 0 to 2. In the body of the inner loop put
an output statement that outputs “loopIntOuter: “ + loopIntOuter +
“ loopIntInner: “ + loopIntInner.
14.Run the program with 32 as the age prompt in Step 9.
15.Enter at least one valid city for Step 12.
16.Enter at least 2 numbers for 15 and then 999.
In: Computer Science
Please use python.
Step a: Create two DataFrames df1 and
df2 from the following two tables that hold
student scores. Each DataFrame has four rows and
three columns.
|
df1: |
df2: |
|||||
|
Name |
Course A |
Course B |
Name |
Course C |
Course D |
|
|
Adam |
80 |
84 |
Bob |
65 |
72 |
|
|
Bob |
74 |
76 |
David |
85 |
82 |
|
|
David |
78 |
83 |
Eva |
76 |
80 |
|
|
Tom |
85 |
82 |
Tom |
90 |
88 |
Step b: Join the two DataFrames into df3 so that it only includes the students who appear in both tables. Print df3.
Step c: Set the column 'Name' as the index of df3 using df3.set_index() function. Print the updated df3. You can learn from https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.set_index.html.
Step d: Show the average score of each student in df3.
In: Computer Science
A PC store sells many types of computers. The PC can have either 16 or 8 gigabytes of memory.
The quality of the PCs can be either New, Refurbished, or Dented.
The price list is given as follows:
Memory size/Status New Refurbished Dented
16 gigabytes 849.99 729.99 609.99
8 gigabytes 699.99 579.99 439.99
Determine the price of a given PC dependent on the user inputs. The sale tax is 9.25% for each PC.
User input can only be 8 or 16 for memory size and 'N', 'R', or 'D' for quality (upper-case). The input quantityt should be 0 or positive.
If any user input is not correct, display an error message and skip all calculation.
All currency amount should be displayed with 2 digits in decimal fraction.
Here are several separate program sample runs. There is No need to use loop for repetition.
Enter the memory size of the PC (8 or 16 gigabytes): 16
Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): N
Enter PC quantity want to buy: 2
The item price is $1699.98
The sale tax is $157.25
The total bill is $1,857.23
----------------------
Enter the memory size of the PC (8 or 16 gigabytes): 8
Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): R
Enter PC quantity want to buy: 3
The item price is $1739.97
The sale tax is $160.95
The total bill is $1900.92
----------------------
Enter the memory size of the PC (8 or 16 gigabytes): 15
Invalid memory size!
----------------------
Enter the memory size of the PC (8 or 16 gigabytes): 8
Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): A
Invalid PC quality!
----------------------
Enter the memory size of the PC (8 or 16 gigabytes): 8
Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): (user hit Tab key)
Invalid PC quality!
----------------------
Enter the memory size of the PC (8 or 16 gigabytes): 16
Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): R
Enter PC quantity want to buy: -2
Invalid PC quantity!
[C++ PROGRAMING]
In: Computer Science
Simulate a D-Flip Flop on Xilinx using Verilog HDL | Behavioral Modelling
PS: please include the simulation screenshot and output and the code
In: Computer Science
Write a program that asks the user to enter a sentence and then switch all lower case letters to capitals and all upper case letters to lower. HINT: use the ASC function to tell your program which letters are upper or lower case so you can switch them. Your program should allow for multiple test cases.
In: Computer Science
Write a program using MARIE’s assembly language. The program consists of a main program and a subroutine. It uses the subroutine to process a given number. If the value of the number is negative, the value will be replaced with zero and returned. Otherwise, the value is doubled and returned. Then, in the main program, it calls the subroutine to process for X = -3 and saves the value after the processing.
In: Computer Science
Write a fragment of code that uses two existing arrays of doubles, a and b, creates a third array c, and assigns each element of c to the average of the corresponding elements of a and b. You may assume that the arrays a and b are the same length. (java)
In: Computer Science
In: Computer Science
Implement a recursive algorithm to compute the product of two integers (in java). Your algorithm can only perform addition and subtraction; no multiplication. Analyze the running time and space complexity of your solution.
In: Computer Science
Host A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 120. Suppose Host A then sends two segments to Host B back-to-back. The first and second segments contain 80 and 50 bytes of data, respectively. In the first segment, the sequence number is 121, the source port number is 30058, and the destination port number is 80. Host B sends an acknowledgment whenever it receives a segment from Host A.
In the second segment sent from Host A to B, what are the sequence number, source port number, and destination port number?
If the first segment arrives before the second segment, in the acknowledgment of the first arriving segment, what is the acknowledgment number, the source port number, and the destination port number?
If the second segment arrives before the first segment, in the acknowledgment of the first arriving segment, what is the acknowledgment number?
In: Computer Science
In: Computer Science
Please provide an example of how MC.sim in R is to be used. The data can be made up, but please provide steps and explanations what to plug into that function. Thanks.
In: Computer Science
Java question:
Explain how class (static) variables and methods differ from their instance counterparts. Give an example of a class that contains at least one class variable and at least one class method. Explain why using a class variable and method rather than an instance variable and method would be the correct choice in the example you select.
In: Computer Science
Select the correct statement(s) regarding TCP.
|
a. TCP is a connectionless protocol |
||
|
b. TCP uses windowing as a means to control network congestion |
||
|
c. TCP does not guarantee the proper sequencing of delivered packets |
||
|
d. all of the above are correct statements |
In: Computer Science
Digital Clock with LCD Display
write the code for the function header:
#include "mbed.h"
#include "TextLCD.h"
1. In this lab, you will redo a digital clock this time with the LCD display and in the format of HH:MM:SS (HH is the hour from 0 -- 23, and MM is the minute from 00 -- 59, and SS is the second from 00-59)
2. Design the circuit that properly connects the LCD display to the mbed platform. Include your connection diagram in the Experiment Results of your lab report.
3. Based on the hardware design from step 2, design your code to implement the digital clock. Upon reset of the board, the clock should reset to 00:00:00, then changed to 00:00:01 after 1 second, and 00:00:02 after another second, etc.
4. Test your digital clock with an accurate clock (e.g. the clock in the computer). Explain the test process and what you observe while carrying out the test process. Is your digital clock accurate? If it is not, explain what you think might be the cause of the inaccuracy. "Calibrate" your digital clock by modifying your code to be as close to the accurate clock as possible. Include the details of your calibration process in your lab report.
I am more interested in the coding. Thanks
In: Computer Science