Questions
Python 3 Fix the code so the program reads the file and see if the bar...

Python 3

Fix the code so the program reads the file and see if the bar code was already inputted 3 times if so, it ishows a warning indicating that the item was already tested 3 times

Code:

import tkinter as tk
from tkcalendar import DateEntry
from openpyxl import load_workbook
from tkinter import messagebox
from datetime import datetime


window = tk.Tk()
window.title("daily logs")
window.grid_columnconfigure(1,weight=1)
window.grid_rowconfigure(1,weight=1)

# labels
tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20)
tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20)
tk.Label(window, text="Money Lost").grid(row=2, sticky="W", pady=20, padx=20)
tk.Label(window, text="sold by").grid(row=3, sticky="W", pady=20, padx=20)
tk.Label(window, text="Failed date").grid(row=4, sticky="W", pady=20, padx=20)

# entries
barcode = tk.Entry(window)
product = tk.Entry(window)
money = tk.Entry(window)

# arraging
barcode.grid(row=0, column=1)
product.grid(row=1, column=1)
money.grid(row=2, column=1)

options = tk.StringVar(window)
options.set("Choose one value")  # default value
soldData = tk.OptionMenu(window, options, "Peter", "John", "Mary", "Jonatan", "Steve")
soldData.grid(row=3, column=1)
cal = DateEntry(window, width=12, background='darkblue', foreground='white', borderwidth=2)
cal.grid(row=4, column=1)

def readValue():
    excel_barcode = barcode.get()
    excel_product = product.get()
    excel_money = money.get()
    excel_sold = options.get()
    if excel_sold.strip() == 'Choose one value':
        messagebox.showwarning("Error", "Please select a value for sold by")
        return
    date = datetime.now()
    print(date)
    data = [excel_barcode, excel_product, excel_money, excel_sold, date]
    workbook = load_workbook("dailylog.xlsx")
    worksheet = workbook.worksheets[0]
    worksheet.append(data)
    workbook.save("dailylog.xlsx")
    cleardate()


def cleardate():
    barcode.delete(0, 'end')
    product.delete(0, 'end')
    money.delete(0, 'end')
    options.set("Choose one value")  # default value
    today = datetime.now()
    cal.set_date(today)


# button to trigger actions
button = tk.Button(text="SUBMIT", command=readValue).grid(row=5, pady=20, padx=20)
button = tk.Button(text="CLEAR", command=cleardate).grid(row=5, column=1, pady=20, padx=20)
window.geometry("500x400")
window.mainloop()

In: Computer Science

How does the scientific method aid human critical reasoning processes? How and why have you made...

How does the scientific method aid human critical reasoning processes? How and why have you made assumptions or inferences on important matters, regardless of data or evidence to the contrary? Examples here might include: fad diets, telepathy, precognition, psychokinesis, vaccinations, UFOs, magnetic therapy, apparitions, cold fusion, Bigfoot, alternative forms of medicines, genetically modified plants, etc. Describe how you have thought about this issue and analyze how you could improve your critical reasoning on this issue using the scientific method.

In: Psychology

What are the three forms of communications for engineers?

What are the three forms of communications for engineers?

In: Civil Engineering

Compare client-server systems and peer-to-peer systems in terms of performance, scalability, fault tolerance, and any other...

Compare client-server systems and peer-to-peer systems in terms of performance, scalability, fault tolerance, and any other feature you think is important.

In: Computer Science

How are global concerns seen in the graphic novels MAUS and The Arrival?

How are global concerns seen in the graphic novels MAUS and The Arrival?

In: Psychology

delete

delete

In: Chemistry

You are considering the following two mutually exclusive projects. The required return on each project is...

You are considering the following two mutually exclusive projects. The required return on each project is 14 percent. Which project should you accept and what is the best reason for that decision?

Year Project A Project B
0 −$ 24,000 −$ 21,000
1 9,500 6,500
2 16,200 9,800
3 8,700 15,200
  • Project A; because it pays back faster

  • Project A; because it has the higher profitability index

    Incorrect
  • Project B; because it has the higher profitability index

  • Project B; because it has the higher net present value

  • Project A; because it has the higher net present value

In: Finance

In the previous verse, we asked the user to input 5 inventory items. In this verse,...

In the previous verse, we asked the user to input 5 inventory items. In this verse, we need to ensure the values they entered are valid values for the two fields of each inventory item. Continue to ask the user to input the inventory id # (integer) and the price (float) for 5 inventory items. After the user enters each value, ensure the value entered is greater than 0. If the value is less than or equal to 0, then write a descriptive error message and end the program. To end a program, call the exit function and pass 0 as an argument.

In: Computer Science

Process: Read the scenario below. Answer the following questions. Identify unethical behavior of Rudy from the...

Process:

  • Read the scenario below.
  • Answer the following questions.
  1. Identify unethical behavior of Rudy from the scenario
  2. Recall the concepts of moral awareness, moral judgement, and moral intent. Which one do you think Rudy does not have? Justify your choice.
  3. Come up with three ideas for reducing theft in this grocery store.

Scenario

Alex Grant recently graduated from college and is excited to be starting his first job as a store manager for The Grocery Cart, a large supermarket chain. The company has a very good management training program, and it is one of the fastest growing chains in the nation.

If Alex does well managing his first store, there are a number of promising advancement opportunities in the company. After completing the store management training program, Alex met with Regina Hill, his area supervisor. She informed Alex that he would be taking charge of a medium-volume store ($250,000 in sales/week) in an upper-class neighborhood. This store had been operating without a store manager for the past six months. The store had also not made a profit in any of the monthly financial reports for the last year.

Hill also shared the following information with Alex: Because the store has been without a store manager for the last six months, the assistant manager (Drew Smith) has been in charge. Drew is known for being highly competent and a solid performer. However, there have been complaints that he is frequently rude to employees and insults and ridicules them whenever they make mistakes. Turnover among sales clerks and cashiers at this store has been somewhat higher than in other stores in the area. The average pay of clerks and cashiers is $7.25/hour. The last two semiannual inventories at this store showed significant losses. There has been a large amount of theft from the store stockroom (an area where only employees are allowed).

Given that the store has generally done well in sales (compared with others in the area) and that most expenses seem well under control, Hill believes that the profitability problem for this store is primarily due to theft. Therefore, she suggested that Alex’s plans for the store should focus on this priority over any others.

When Alex arrived for his first day of work in his new store, he saw that Drew was in the process of terminating an employee (Rudy Johnson) who had been caught stealing. Alex immediately went to the break room of the store where the termination interview was being conducted to learn more about the situation.

Drew informed Alex that Rudy had been a grocery clerk for the past six weeks and that he had apparently figured out how to tell if the alarms to the stockroom doors were off. Rudy would then open the back stockroom doors and stack cases of beer outside the store to pick up after his shift. After Drew caught Rudy doing this, Drew had a conversation with one of his friends who works as a restaurant manager down the street. Drew’s friend noted that he had hired Rudy a few months ago and that he’d been caught stealing there too.

Turning to Rudy, Drew asked, “So, Rudy, what do you have to say for yourself?” Rudy quickly replied: “Look here, [expletive], you don’t pay me enough to work here and put up with this garbage. In fact, you’re always riding everyone like they’re your personal servant or something. So I was trying to get some beer. I’ve seen you let stockers take home damaged merchandise a dozen times. So just because they cut open a box of cookies, which we all know they do on purpose, they get to take stuff home for free. For that matter, we’ve all seen you do the same thing! I’ve never seen you make a big deal about this stuff before. Why can’t I get a few cases of beer? What’s the big deal?”

In: Operations Management

JAVA programing language: What is printed when the following code is executed? int columns; int rows;...

JAVA programing language:

What is printed when the following code is executed?

int columns;

int rows;

for(rows = 1; rows < 2; ++rows) {

for(columns = 1; columns < 3; ++columns) {

System.out.print("x");

}

System.out.println():

}

select one:

A)

xx

B)

xxx

xxx

C)

x

x

D)

xx

xx

xx

In: Computer Science

Analyze how TV, radio, yellow pages, newspaper, magazines, and the Internet can complement each other in...

Analyze how TV, radio, yellow pages, newspaper, magazines, and the Internet can complement each other in promoting, in the state of North Carolina, the market-leading company of any industry that you are most interested to study.

In: Operations Management

/* Assignment : Complete this javascript file according instructions in comments. */ // 1) Create a...

/* Assignment :
Complete this javascript file according instructions
 in comments. */

// 1) Create a for loop that loops through its code block 10 times
// In the first statement, set the variable i equal to zero
// In the second statement, tell the loop to execute while i is less than ten
// In the third statement, increment i by one each time the loop executes
// In the code block of the loop, print the variable i to the console



// 2) Create an array named foods and put your 5 favorite foods
// in the array as items.
// 5 fav foods = sushi, ramen, korean bbq, pizza, wings
// Create a for / in loop that will loop through the items in the foods array
// Print a favorite food item to the console each time the loop executes
// When finished, you should have printed each favorite food item to the console



// 3) Create a variable x and set it equal to 50.
// Create a while loop that executes while x is greater than zero.
// Print the value of x to the console every time the loop executes.
// Decrement the value of x by one every time the loop executes.
// Your loop should count backwards from 50 to 1 and print each number in the
// console.



// 4) Create a variable named myNum and set it equal to 10.
// Create a while loop that executes while myNum is less than 5.
// In the loop, print the value of myNum to the console.
// Below that loop, create a do / while loop.
// Set the while condition the same as first while loop.
// Print the value of myNum to the console in the loop.
// Comment below your loops to explain the outcome. /* multi-line comment */



// 5) Create a variable named x and set it equal to zero.
// Create a while loop that executes while x is less than ten.
// In the code block of the loop, set x equal to a random number between
// one and ten using the previous random number formula we learned with
// the Math object.
// After assigning x the random number, print the value of x to the console.
// The loop should continue to execute until the value of x equals 10.

In: Computer Science

A diverging lens has a focal length of 14.0 cm. Locate the images for each of...

A diverging lens has a focal length of 14.0 cm. Locate the images for each of the following object distances. For each case, state whether the image is real or virtual and upright or inverted, and find the magnification. (a) 28.0 cm q = cm (b) 14.0 cm q = cm

In: Physics

Please (a) in any industry of your own selection, please identify a dilemma involving the use...

Please (a) in any industry of your own selection, please identify a dilemma involving the use of overseas suppliers in a US company’s supply chain. The dilemma has to involve a difficult decision where it is hard to please both investors and customers; (b) discuss your alternatives to solve the dilemma; (c) recommend the best alternative; (d) explain why the recommendation provides a comprise that manages to make, to a reasonable degree even though not perfectly, both investors and customers happy.

In: Operations Management

c++ Create a program that creates a sorted list from a data file. The program will...

c++ Create a program that creates a sorted list from a data file. The program will prompt the user for the name of the data file. Create a class object called group that contains a First Name, Last Name, and Age. Your main() function should declare an array of up to 20 group objects, and load each line from the input file into an object in the array. The group class should have the following private data elements: first name ,last name age The group class should have the following functions: Constructor(s) Destructor - optional Get - read first name, last name, and age from an input stream Put - write last name, first name, and age to an output stream The group class should have the following operators: > < == compare the group to another group, using Last name, First name, then age, and return a bool Your program should do the following: Prompt the user for the name of the file Open the file Read the data into the array of group objects (maximum size 20) Close the file Sort the array Display the array ============== text file Ann ember 70 jacob Mark 68 David smith 45 Frank lee 37 John doe 30 Kathleen honor 34 bob ember 42 bob ember 13 Richard start 47 Susan hox 36 Expert Answer

In: Computer Science