#(a) Write a program that keeps asking the user for their name until they enter "Tim". Otherwise, keep saying "You are not Tim!" and ask for their name.
#(b) Allow your name as a valid input as well.
#(c) Keep track of how many times the user fails to enter the correct name, and report it when they finally get it right. (2K, 2C)
1. You operate several BurgerStands distributed throughout town. Define a class named BurgerStand that has a member variable for the burger stand's id number and member variable for how many burgers that stand sold that day.
a) create a constructor that allows user of the class to initialize values for id number and for how many burgers sold that day and a destructor
b) create a function named justsold that show increments of the number of burgers the stand has sold by one. (This function will invoked each time the stand sells a burger so that you can track the total number of burgers sold by the stand. And returns the number of burgers sold.)
c) create a function that calculate the total number of burgers sold by all stands.
d) write in a data file, the list of burger stands and the total number of burgers sold by all stands.
You are a robot assigned to place three Knights on a 3 x 3 chess board such that (1) all Knights do not attack each other, (2) only one Knight is placed in each row, and (3) only one Knight is placed in each column. Recall that a knight attacks in an “L” pattern, i.e., a knight moves two spaces rectilinearly and then one space at right angles to the initial movement.
For the benefit of students who do not play chess, the following boards illustrate the allowed cells (marked as O) and prohibited cells (marked as X) after you place a knight (marked as K) at a cell. Once a knight is placed at a cell marked as K, any other knight may be placed only in a cell marked as O, and may not be placed in a cell marked as X. Only symmetry-collapsed positions are shown below. All other constraint positions may be obtained by symmetry reflections and rotations.
row 3
K
X
X
row 3
X
O
X
row 3
O
X
O
row 2
X
O
X
row 2
K
X
X
row 2
X
K
X
row 1
X
X
O
row 1
X
O
X
row 1
O
X
O
col
C1
col
C2
col
C3
col
C1
col
C2
col
C3
col
C1
col
C2
col
C3
You decide to formulate this task as a CSP in which columns are the variables (named C1 through C3) and rows are the domain values (named 1, 2, and 3). After you have solved the CSP, each column (variable) will be assigned a row (value), and all constraints will be satisfied. The columns (variables) are C1-C3:
• C1, col 1 - will be assigned the row number of the knight in column 1
• C2, col 2 - will be assigned the row number of the knight in column 2
• C3, col 3 - will be assigned the row number of the knight in column 3
The rows (domain values) are the digits 1-3:
1, the knight in that column is in row 1
2, the knight in that column is in row 2
3, the knight in that column is in row 3
There are no unitary constraints, and so the initial variable domains include all possible values:
D1 = {1, 2, 3} D2 = {1, 2, 3} D3 = {1, 2, 3}
First of all think all CSP constraints as explicit relations of all allowed pairs of variable values: Implement constraint graph associated with your CSP and then Run arc consistency also comment on your results.
(a) Write a program which will ask the user how many symbols to output, and then output that many lines of symbols (one symbol on each line). To start, use the '*' symbol. (1K)
(b) Write a program which will ask the user how many symbols to output, and then it will output that many symbols on one line. To start, use the '*' symbol. (1K)
For example, if the user enters 5, the output would be:
*****
(c) Output the user's number as well as the symbols, all on the same line. For example, if the user entered a value of 10, the output would be: (1K)
10 **********
(d) Modify your program to allow the user to choose a symbol as well. (1K)
Number of symbols? 7
Symbol to use? @
7 @@@@@@@
(e) Allow the user the specify the total number of symbols and how many to print on each line.
For example, if the user entered 10 symbols with 4 per line, the output might be: (2T)
$$$$
$$$$
$$
(the last line only has two symbols because we only print 10 total)
'''
symbol = '*'
numOfSymbols = int(input("how many symbols do you want: "))
#A)
for count in range(numOfSymbols):
print(symbol)
#B)
print(symbol*numOfSymbols)
#C)
'''
(a) Output the times-tables (from 1 to 12) for whichever number the user requests. For example, if the user enters 3, your output should be: (1K)
1 x 3 = 3
2 x 3 = 6
...
12 x 3 = 36
Extension:
(b) Allow the user to specify the start and end to the table (e.g., 4 to 15); (2K)
(c) Allow the user to specify the step size (e.g., by 3 is 4, 7, 10, 13). (2T)
'''
The garments company Apparel wishes to
open outlets at various locations. The company
shortlisted several plots in these locations and
wishes to select only plots that are square-
shaped.
Write an algorithm to help Apparel find the
number of plots that it can select for its outlets.
#(a) Ask the user for their name and output the name 5 times.
#Extension:
#(b) Allow the user to specify the number of outputs. (1T, 1K)
Write a comparison report of the JArchitect and McCabe IQ tool. Your report must cover the following: 1. Snapshot of Installation process 2. Features of both JArchitect and McCabe IQ tool 3. Run the same source code on both JArchitect and McCabe IQ tool. 4. Conclusion
I. Write a comprehensive report on Roslyn Analyzers and FxCop Analyzers. Your report must fulfil the following requirement, [10 marks]
a) Snapshot for the installation of the latest version of Roslyn Analyzers and FxCop Analyzers.
b) List the core features of Roslyn Analyzers.
c) List the core features of FxCop Analyzers.
d) Write a simple CRUD application in C#.
e) Run the Roslyn Analyzers on your application source code to generate the analysis report. Include the snapshot of the result in your report.
f) Fix the violations reported by Roslyn Analyzers. Include the snapshot of the result in your report after fixing all the issues.
g) Run the FxCop Analyzers on your application source code to generate the analysis report. Include the snapshot of the result in your report.
h) Fix the violations reported by FxCop Analyzers. Include the snapshot of the result in your report after fixing all the issues.
i) Write a section in your report to discuss the advantages and disadvantages (if any) of using Roslyn and FxCop Analyzer
Compute the cyclomatic complexity of the following sample codes: Sample Code 1:
/*
* C Program to Print Diamond Pattern
*/
#include <stdio.h>
int main()
{
int number, i, k, count = 1;
printf("Enter number of rows\n"); scanf("%d", &number);
count = number - 1;
for (k = 1; k <= number; k++)
{
for (i = 1; i <= count; i++) printf(" ");
count--;
for (i = 1; i <= 2 * k - 1; i++) printf("*");
printf("\n");
}
count = 1;
for (k = 1; k <= number - 1; k++)
{
for (i = 1; i <= count; i++) printf(" ");
count++;
for (i = 1 ; i <= 2 *(number - k)- 1; i++) printf("*");
printf("\n");
}
return 0;
}
Sample code 2:
# Python program to # print Diamond shape
# Function to print # Diamond shape
def Diamond(rows): n = 0
for i in range(1, rows + 1): # loop to print spaces
for j in range (1, (rows - i) + 1):
print(end = " ")
# loop to print star while n != (2 * i - 1):
print("*", end = "") n = n + 1
n = 0
# line break print()
k = 1
n = 1
for i in range(1, rows): # loop to print spaces
for j in range (1, k + 1): print(end = " ")
k = k + 1
# loop to print star
while n <= (2 * (rows - i) - 1):
print("*", end = "") n = n + 1
n = 1 print()
# Driver Code
# number of rows input rows = 5 Diamond(rows)
Also, create a GUI tool for Cyclomatic complexity using any language. Run the above sample code on your tool to validate your answer.