Write a C++
Program to print the first letter of your first and last name using
stars.
Note:
1) Using nested For
Loop
2) The number of lines is
given by user.
3) Using one Outer loop to
print your letters.
4) Print the letters
beside each other
In: Computer Science
IN C++ PLS COMMENT CODDEE, SO I CAN UNDERSTAND WHAT YOU DOING Stack application: postfix expression evaluation. Description: - The stack data structure can be used to evaluate postfix expressions. Please refer to the first 14 pages of this tutorial for postfix expression evaluation: http://www.cs.nthu.edu.tw/~wkhon/ds/ds10/tutorial/tutorial2.pdf Requirement: - deal with single digit positive integers only. Operands and operators are fully separated by space. - learn and use STL stack: http://www.cplusplus.com/reference/stack/stack/ - learn and use isdigit(): http://www.cplusplus.com/reference/cctype/isdigit/ - take in a postfix arithmetic expression from cin, and evaluate its value. - supported operators: +, -, *, / - for invalid postfix expression, print out an error message and end the program. - output the evaluated value of valid expressions. Example1: - (valid expr) 4 3 - 5 * -- push 4 into stack -- push 3 into stack -- minus operator (-) detected: pop 3 out of stack, as operand_2 -- pop 4 out of stack, as operand_1 -- perform operand_1 minus operand_2, then push the result (1) into stack. -- push 5 into stack -- multiply operator (*) detected: pop 5 out of stack, as operand_2 -- pop 1 out of stack, as operand_1 -- perform operand_1 times operand_2, then push the result (5) into stack. -- input done. check stack value... output final answer: 5
In: Computer Science
boolean isEligibile (int, char, char) using Drjava
isEligibile will return true when the customer is eligible to book
a vacation package, and false otherwise. It takes as input 3 pieces
of information, first an int representing the customer’s age.
Second, a char representing the country where the rental is being
made (‘c’ for Canada, ‘u’ for United States, ‘f’ for France). The
third input is a char representing if the customer has a valid
Canadian passport ‘y’ for Yes, ‘n’ for No.
A customer is eligible to book a package under the following
conditions:
If the customer is in Canada, they must be over 21.
If the customer is in the United States, they must be over
18.
If the customer is in France, they must be over 25.
If the customer does not have a valid passport, they are not
eligible to book a package in France or the United
States.
In: Computer Science
Step 1: Create a new Java project named ContainerPartyProject
---------
Step 2: Add a ContainerParty class to your project. It should contain:
- The date of the party
- A list of people attending
- A list of containers at the party
- The address of the party (this can be either a String or a Class)
---------
Step 3: Add a Container class in your project. It should be an abstract class. Your Container class must be properly encapsulated and include the following attributes:
In addition to a constructor that allows you to set all of these values, it should include a getInfo() method and an abstract calculateVolume() method.
---------
Step 4: Add a CircularContainer class to your project. Your CircularContainer must be a subclass of your Container class. In addition to the attributes that it inherits from Container, CircularContainer should add the following attributes:
It should include a getInfo() method and a calculateVolume() method that override the versions of these methods from your parent class. You may use the following formula for volume:
volume=π⋅radius2⋅height
---------
Step 5: Add a RectangularContainer class to your project. Your RectangularContainer must be a subclass of your Container class. In addition to the attributes that it inherits from Container, RectangularContainer should add the following attributes:
It should include a getInfo() method and a calculateVolume() method that override the versions of these methods from your parent class. You may use the following formula for volume:
volume=length⋅width⋅height
Important: In steps 3 and 4, your getInfo() methods must use the super keyword to leverage the getInfo() method of its superclass (Container). Remember DRY - Don’t Repeat Yourself! You should not unnecessarily duplicate any code between getInfo() in your subclass and superclass!
---------
Step 6: Create a Person class with 3 attributes of your choice. Create attributes, methods, and constructors as necessary to complete the assignment.
---------
In: Computer Science
According to the university's website design request, students need to order five books, one for each of the five required courses that all students take. You need to design a program that will prompt students for the price of each book and display the total cost for the five books.
The university reassessed its needs for the website design and determined it will no longer require all students to take five classes.
Update the website program to reflect the following changes:
Create a 1/2- to 1-page document containing pseudocode based on the revised program needs.
Create a 1-page flowchart based on the algorithm for the revised program needs.
In: Computer Science
what are the different types of WebGL primitives? explain in details each one of them
In: Computer Science
#include <cstring>
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
const int SIZE = 20;
char str[SIZE];
char str1[SIZE];
int n;
int k =1;
printf("Enter a word: \n");
fgets(str,SIZE,stdin);
printf("Enter another word: \n");
fgets(str1,SIZE,stdin);
if (str1[strlen(str1) - 1] == '\n')
{
str1[strlen(str1)-1] =
'\0';
}
if (str[strlen(str) - 1] == '\n')
{
str[strlen(str)-1] =
'\0';
}
printf("Enter a number between 1 and 20:
\n");
scanf("%d",&n);
strcat(str, " ");
strncat(str, str1,n);
printf("%s", str);
printf("\n");
str[0] = toupper(str[0]);
for (int i = 1; i < strlen(str); i++)
{
str[i] =
tolower(str[i]);
if(str[i-1] == '
')
{
str[i]= toupper(str[i]);
}
}
for (int j = 1; j < strlen(str); j ++)
{
for (int i = 1; i <
strlen(str); i++)
{
//
if(str[i]!= '\0')
{
if(!strstr(str, "here"))
{
k++;
}
if(strchr(str,'\0'))
{
break;
}
}
}
}
cout << "Found "<< k << "
words 'here' in: \n" << str;
return 0;
}
================================================================================
so im practicing working on c++ with c-strings and i when i compile and run this, at the end the loop iterates one time for the entire length of the cstring and i cannot figure out how to end it after finding the 'k' amount of times the word "here" is in the string.
In: Computer Science
Python Coding Question (Data Science)
Hello I am having difficulty writing a code in python to do a specific task. I have two text files, Positive.txt and Practice_forhw1.txt. I want to write a script that will check if any words in Practice_forhw1.txt match any of the words in Positive.txt then the word would get replaced with a "+1" in the Practice_forhw1.txt and then print out the Practice_forhw1.txt. (i.e if the word "happy" is in both Positive.txt and Practice_forhw1.txt then I want the word "happy" to get replaced with a +1 in the Practice_forhw1.txt file.
My poor attempt below:
pos_file = open("Positive.txt", 'r')
#positive words are now in a list
pos_list = pos_file.readlines()
p_file = open("Practice_forhw1.txt", 'r')
p_list = p_file.readlines()
for word in p_list:
if word in p_list == word in pos_list:
word = word.replace(word, '+1')
print (word)
In: Computer Science
Using the Boyer-Moore algorithm, find the Bad Match table for the below patterns.
Pattern1: AABCACCCA
Pattern 2: CCCAAABBD
Pattern3: ABCABCBAD
Pattern4: BSDGSBAA
In: Computer Science
Need this in C++
// Start
// Declarations
// InputFile masterFile;
// InputFile transactionFile;
// OutputFile newMasterFile;
// num mClientNumber, mtotalClientCost, tClientNumber, titemClientCost
// string mClientfName, mClientlName// output "Master File Updating Starting"
// open masterFile "Master.rtf"
// open transactionFile "Transaction.rtf"
// open newMasterFile "newMaster.rtf"
// read mClientNumber, mClientfName, mClientlName, mtotalClientCost from masterFile
// read tClientNumber, titemClientCost from transactionFile
// while ( transactionFile not EOF )
// while (( masterFile not EOF) and (mClientNumber < tClientNumber))
// output mClientNumber, mClientfName, mClientlName, mtotalClientCost to newMasterFile
// read mClientNumber, mClientfName, mClientlName, mtotalClientCost from masterFile
// endwhile
// if (masterFile is EOF)
// output "Error Client ID: ", tClientNumber, " not in Master File."
// else if (mClientNumber == tClientNumber) then
// mtotalClientCost = mtotalClientCost + titemClientCost
// output mClientNumber, mClientfName, mClientlName, mtotalClientCost to newMasterFile
// read mClientNumber, mClientfName, mClientlName, mtotalClientCost from masterFile
// else if (mClientNumber > tClientNumber) then
// output "Error Client ID: ", tClientNumber, " not in Master File."
// endif
// read tClientNumber, titemClientCost from transactionFile
// endwhile
// while (masterFile not EOF)
// output mClientNumber, mClientfName, mClientlName, mtotalClientCost to newMasterFile
// read mClientNumber, mClientfName, mClientlName, mtotalClientCost from masterFile
// endwhile
// output "Master File Updating Complete"
// close masterFile
// close transactionFile
// close newMasterFile
// Stop
In: Computer Science
Write an HTML file that create the following web page.
my first nested list
steps of backing a cake
Important notes:
In: Computer Science
Consider the TA assignment problem where n Teaching
Assistants
(TAs) are to be assigned to n courses with one course having
exactly
one TA. Each course ranks all of the TAs, and each TA ranks all
the
courses, from most to least desirable.
Can you provide an example of an assignment and preference lists
such
that every TA and course forms an unstable pair? (Yes/No). If
Yes,
present the assignment. If No, justify your answer.
note: gale shapley algorithm
In: Computer Science
Consider the following set of processes, with the length of the CPU-burst time given in milliseconds, and the priority given in integers (lower numbers represent higher priorities) :
Process Arrival Time Burst Time priority
P1 0 17 2
P2 5 8 3
P3 7 11 1
a. Draw Gantt charts illustrating the execution of these processes using nonpreemptive priority and preemptive priority, and Round Robins scheduling (time quantum = 4 ms).
b. What is the turnaround time of each process for each of the scheduling algorithms in part a?
In: Computer Science
In: Computer Science
SHOW WORK
Sort the given keys using Counting sort algorithm. Also write the algorithm.
5, 2, 3, 1, 0, 2, 1, 5, 0
SHOW WORK!
In: Computer Science