1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zaharov [31]
3 years ago
6

Write a GUI program that calculates the average of what an employee earns in tips per hour. The program’s window should have Ent

ry (font: Courier New) widgets that let the user enter the number of hours they worked and amount they earned in tips during they time. When a Calculate button is clicked, the program should display the average amount they got paid in tips per hour. Use the following formula: Tips per hour = amount of tips in dollars / hours.
Computers and Technology
1 answer:
Luba_88 [7]3 years ago
4 0

Answer:

Explanation:

Using Code:

from tkinter import *

#object of Tk class to make GUI

root = Tk()

#creating a canvas to put labels, entries and button

canvas1 = Canvas(root, width = 300, tallness = 200)

canvas1.pack()

#label for number of hours worked

label1 = Label(root, text = "Hours : ", textual style = ('Courier', 10))

canvas1.create_window(80, 50, window = label1)

#entry for number of hours worked

entry1 = Entry(root, textual style = ('Courier', 10))

canvas1.create_window(200, 50, window = entry1)

#label for sum they earned in tips

label2 = Label(root, text = "Tips : ", textual style = ('Courier', 10))

canvas1.create_window(80, 80, window = label2)

#entry for sum they earned in tips

entry2 = Entry(root, text style = ('Courier', 10))

canvas1.create_window(200, 80, window = entry2)

#label for tips every hour

label3 = Label(root, text = "Tips Per Hour : ", textual style = ('Courier', 10))

canvas1.create_window(80, 150, window = label3)

#function to figure tips every hour

def TipsPerHour():

#getting estimation of hour

hours = int(entry1.get())

#getting estimation of tips

tips = int(entry2.get())

#calculating normal sum got paid in tips every hour

normal = tips/hours

#creating a name to show normal

label4 = Label(root, text = "$" + str(average), textual style = ('Courier', 10))

canvas1.create_window(170, 150, window = label4)

#button for compute

calculateButton = Button(root, text = "Compute", textual style = ('Courier', 10), order = TipsPerHour)

canvas1.create_window(170, 110, window = calculateButton)

#mainloop

root.mainloop()

You might be interested in
Python;
riadik2000 [5.3K]

a = int(input("Class A tickets sold: "))

b = int(input("Class B tickets sold: "))

c = int(input("Class C tickets sold: "))

print("Total income generated: $"+str((a*20)+(b*15)+(c*10)))

I hope this helps!

4 0
2 years ago
What some one ask me if i am more of hardware or software person, what is that mean?
balu736 [363]

Answer: Any person or people asking about someone being a hardware or software person displays that they are questioning about the computer knowledge of the person and his/her interest.

The interest can be regarding software tools for programming, designing ,  etc or hardware device like troubleshooting, assembling the computer parts ,etc.

The person persisting good knowledge about software programming language and software is diverted towards software side .The person who likes to deal with hardware parts of the computer system is hardware-oriented person.

7 0
3 years ago
Construct a class that will model a quadratic expression (ax^2 + bx + c). In addition to a constructor creating a quadratic expr
stich3 [128]

Answer:

Following are the code to this question:

#include <iostream>//header file

#include<math.h>//header file

using namespace std;

class Quadratic//defining a class Quadratic  

{

private:

double a,b,c;//defining a double variable

public:

Quadratic()//defining default constructor

{

a = 0;//assigning value 0  

b = 0;//assigning value 0  

c = 0;//assigning value 0  

}

Quadratic(double a, double b, double c)//defining a parameterized constructor  

{

this->a = a;//use this keyword to hold value in a variable

this->b = b;//use this keyword to hold value in b variable

this->c = c;//use this keyword to hold value in c variable

}

double getA() //defining a get method  

{

return a;//return value a

}

void setA(double a)//defining a set method to hold value in parameter

{

this->a = a;//assigning value in a variable

}

double getB() //defining a get method  

{

return b;//return value b

}

void setB(double b)//defining a set method to hold value in parameter  

{

this->b = b;//assigning value in b variable

}

double getC() //defining a get method

{

return c;//return value c

}

void setC(double c)//defining a set method to hold value in parameter

{

this->c = c;//assigning value in c variable

}

double Evaluate(double x)//defining a method Evaluate to hold value in parameter

{

return ((a*x*x)+(b*x)+c);//return evaluated value

}

double numberOfReal()//defining a method numberOfReal to calculates the real roots

{

return (b*b)-(4*a*c);//return real roots

}

void findroots()//defining a method findroots

{

double d=numberOfReal();//defining double variable to hold numberOfReal method value

if(d<0)//use if block to check value of d less than 0

cout<<"Equation has no real roots"<<endl;//print message

else

{

double r1=(-b+sqrt(numberOfReal()))/(2*a);//holding root value r1

double r2=(-b-sqrt(numberOfReal()))/(2*a);//holding root value r2

if(r1==r2)//defining if block to check r1 equal to r2

cout<<"Equation has one real root that is "<<r1<<endl;//print message with value

else//else block

cout<<"The equation has two real roots that are "<<r1<<" and "<<r2<<endl;////print message with value

}

}

void print()//defining a method print  

{

cout<< a << "x^2 + " << b << "x + " << c <<endl;//print Quadratic equation

}

};

int main()//defining main method  

{

Quadratic q(5,6,1);//creating Quadratic class object that calls parameterized constructor

q.print();//calling print method

cout<<q.numberOfReal()<<endl;//calling method numberOfReal that prints its value

q.findroots();//calling method findroots

cout<<q.Evaluate(-1);//calling method Evaluate that prints its value

return 0;

}

Output:

5x^2 + 6x + 1

16

The equation has two real roots that are -0.2 and -1

0

Explanation:

In the above code, a class "Quadratic" is declared, which is used to define a default and parameter constructor to holds its parameter value.

In the next step, the get and set method is defined that holds and returns the quadratic value, and "Evaluate, numberOfReal, findroots, and print" in the evaluate method a double variable is used as a parameter that returns evaluated value.

In the "numberOfReal" method it calculates the real roots and returns its value. In the "findroots" method a double variable "d" is declared that hold "numberOfReal" value,

and use a conditional statement to check its value, and in the print method, it prints the quadratic equation.

In the main method, the lass object it calls the parameterized constructor and other methods.

5 0
2 years ago
Ports that expand the options for input, output, and storage, are commonly called ____________ ports.
Ostrovityanka [42]
The answer is expansion ports
5 0
2 years ago
Which sns gets its names from one of its unique features
Komok [63]

Answer:

no

Explanation:

3 0
2 years ago
Other questions:
  • How can rows be added to a table? Check all that apply
    13·2 answers
  • Which group on the Home Tab allows you to add shapes to a PowerPoint slide?
    9·2 answers
  • In risk management what does risk evaluation involved
    14·1 answer
  • Which of the following statements holds true for the term "html"? It refers to a system that connects end users to the Internet.
    10·2 answers
  • Loops are frequently used to ____; that is, to make sure it is meaningful and useful.
    12·1 answer
  • Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing li
    14·1 answer
  • Suggest three ways in which celebrating an occasion influences food choices?
    10·2 answers
  • daniel wants to buy a computer to use for playing games after work. he loves racing games and wants to make sure his device has
    9·1 answer
  • When creating a report,you can mske groups and subgroups by?​
    5·1 answer
  • Which option should Gina click to edit the text contained in a text box on a slide in her presentation?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!