The purpose of this homework is to test your knowledge of GUI. Consider a fictional park where the entry price for 1 adult ticket is $50, and for 1 children ticket is $25. Write a simple GUI application that let user to enter the number of tickets and display the total price. The GUI should contain:
● One text field for the user to enter the number of adult tickets
● One text field for the user to enter the number of children tickets
● One button “Calculate total cost”
● One text field to display the total cost When the user clicks the button then the correct cost is displayed in the total price field. If the input text field is empty then it should be treated as 0 tickets.
In: Computer Science
// Lab Homework 11
// Logical Operator AND and OR
// Demonstrate how to use a logical operator
// with a Boolean expression.
#include <iostream>
#include <cctype> // for tolower()
using namespace std;
int main()
{
int numberOfCreditHours; // Number of credit hours
student has completed
float gpa; // The student's cumulative grade point
average
// Ask the user two questions:
cout << "Answer the following questions:"
<< endl << endl;
cout << "How many credit hours have you
completed (0-200): ";
cin >> numberOfCreditHours;
cout << "What is your cumulative GPA
(0.00-4.00)? ";
cin >> gpa;
cout << endl;
// TODO: Students can petition for graduation
if:
// - they have completed 48+ credit hours
// - they have a GPA of 2.0 or greater
//
// Use Logical operators in complex logical
expressions to decide which of the following
// four messages to print:
//
// 1) You may petition for graduation.
// 2) You must raise your GPA before you can
graduate.
// 3) You must complete more credit hours before you
can graduate.
// 4) You must raise your GPA and complete more
credits before graduating.
//
// Use just ONE of the logical operators below in the
expression
// to choose the approprate message. You MAY use the
chosen operator
// more than
once.
//
// Logical AND: &&
// Logical OR: ||
//
// Note: Do NOT worry about situations where the user
doesn't enter Y, y, N, or n
// Use the if structure provided below.
if // (<write a compound logic expression here
for graduating>)
//graduation message
else if // (<write a compound logic expression
here for too low gpa>)
//raise gpa message
else if // (<write a compound logic expression
here for too few credits>)
//complete more credits message
else // else is good enough, no logic expression
needed - it's the only other possibility
// raise gpa and earn more credits
message
cout << endl << endl;
return 0;
}
/* Sample interaction and output:
Test #1
==========================================
Answer the following questions:
How many credit hours have you completed (0-200): 60
What is your cumulative GPA (0.00-4.00)? 3.75
You may petition for graduation.
Press any key to continue . . .
Test #2
==========================================
Answer the following questions:
How many credit hours have you completed (0-200): 60
What is your cumulative GPA (0.00-4.00)? 1.99
You must raise your GPA before you can graduate.
Press any key to continue . . .
Test #3
==========================================
Answer the following questions:
How many credit hours have you completed (0-200): 47
What is your cumulative GPA (0.00-4.00)? 3.25
You must complete more credit hours before you can graduate.
Press any key to continue . . .
Test #4
==========================================
Answer the following questions:
How many credit hours have you completed (0-200): 45
What is your cumulative GPA (0.00-4.00)? 1.75
You must raise your GPA and complete more credits before graduating.
Press any key to continue . . .
*/
In: Computer Science
In: Computer Science
Please create (if not already in your linux home directory) files of any type. Once these files are created, archive them, compress the archive and move these files to the thrash directory. This could be a script to be run from the shell or the script to be run from an executable file.
Submit your code and clearly explain all steps of your script.
In: Computer Science
Write pseudocode for quick find algorithm anf quick union algorithm
Write pseudocode for quick find algorithm and quick union algorithm
In: Computer Science
quicksort the array step by step
63,19,32,11,87,3,87,24,48,39
In: Computer Science
Create a generic method to print objects in java. Include a tester class.
In: Computer Science
Linux
Create a simple 'user' file -user name, user id, some few other
fields (at your discretion). Name it 'users'. Enter about 10
entries there.
Create a simple 'user_data' file -user name, phone, address etc at your discretion.. User names in both files should match. So there would be 10 users in both files. You probably want to do these files as tab -separated, rather than space separated.
In: Computer Science
Why was the class-ful IP addressing scheme changed to class-less (CIDR) addressing?
In: Computer Science
In: Computer Science
In: Computer Science
Make a function that swaps the values that change the values between the parameters as the following rule.
The functions swap takes 2, 3 or 4 parameters and these functions are implemented as the overloading functions.
In: Computer Science
Write a Python program in a file called consonants.py, to solve the following problem using a nested loop. For each input word, replace each consonant in the word with a question mark (?). Your program should print the original word and a count of the number of consonants replaced. Assume that the number of words to be processed is not known, hence a sentinel value (maybe "zzz") should be used. Sample input/output:
Please enter a word or zzz to quit: Dramatics
The original word is: dramatics
The word without consonants is: ??a?a?i??
The number of consonants in the word are: 6
Please enter another word or zzz to quit: latchstring
The original word is: latchstring
The word without consonants is: ?a??????i??
The number of consonants in the word are: 9
Please enter another word or zzz to quit: YELLOW
The original word is: yellow
The word without consonants is: ?e??o?
The number of consonants in the word are: 4
Please enter another word or zzz to quit: zZz
In: Computer Science
In: Computer Science