Questions
need to write code for a Paint job estimator program on python specs: A painting company...

need to write code for a Paint job estimator program on python

specs:

A painting company has determined that for every 350 square feet of wall space, one gallon of paint and six hours of labor are required. The company charges $62.25 per hour for labor. Write a program call paintjobestimator.py that asks the user to enter the square feet of wall space to be painted and the price of the paint per gallon. The program is to display the following information.

  • The number of gallons of paint required rounded up to whole gallons.
  • The hours of labor required.
  • The cost of the paint based on the rounded up whole gallons.
  • The labor charges.
  • The total cost of the paint job.

At the end of one estimate the user it to be asked if they would like to perform another estimate. Use the prompt: Would you like to do another estimate? (y/n) If the user answers y, then the program is to accept input for another estimate. If the user answers with anything other than y, the program is to exit.

The user input should not be able to crash the program. If the user provides invalid input the program should tell the user why the input is invalid and ask again for the input.  

The square feet of wall space and the price of the paint per gallon must be positive values. If the user enters 0 or a negative value, the program should tell the user why the input is invalid and ask again for the input.

The output is to be nicely formatted. Hours of labor is to be displayed to one decimal point (example: 12.4 hours). Gallons of paint is to be displayed as an integer value with nothing shown to the right of the decimal point (example: 5). Total labor charges is to be displayed to two decimal points and a $ is to be displayed at the start of the total labor charge value (example: $152.64).

The gallons of paint is rounded up to whole gallons because the paint is colored and mixed in whole gallons. If paint is left over it can’t be used on another job. You will need to find a way in Python to do the math to calculate the gallons of paint so that the result is a whole number that is a rounded up value based on the division of the square feet of space by the 350 square feet per gallon. For example, if the area to be painted is 1800 square feet, then 1800 / 350 is 5.142857 gallons. The rounded up whole gallons result is 6. Five gallons of paint is not enough. The need for some amount more than 5 gallons means the job requires 6 gallons even if all of it will not be used.

this is what i have so far:

import math


def main():
while True:

# Taking the input from the user for the square feet of the wall to paint and ask use until the user enters positive integer value

while True:

square_feet = input('Enter square feet of wall to paint: ')

square_feet = int(square_feet)

if square_feet < 0:

print('square feet has to be positive integer')

continue

elif square_feet == 0:

print('square feet must be positive not zero')

continue

# if square feet is greater than 0 the loop terminates

else:

break

# Taking the input from the user for the pricePaint of the painting bucket and ask the user until the user enters positive integer value

while True:

pricePaint = input('Enter pricePaint of paint per gallon: ')

pricePaint = int(pricePaint)

if pricePaint < 0:

print('price has to be positive integer')

continue

elif pricePaint == 0:

print('price has to be positive integer not zero')

continue

# if pricePaint > 0 the loop terminates

else:

break

# getting Gallons based on the price of the paint

Gallons = square_feet / 350

# calculating the number of numOfHours required to paint

number_of_hours = Gallons * 6

Gallons = math.ceil(Gallons)

# getting cost of the paint from Gallons

paintCost = pricePaint * Gallons

# getting theLaborCharge based on number of numOfHours

the_Labor_Charge = 62.25 * number_of_hours

# calculating total paint cost

totalCost = paintCost + the_Labor_Charge

print("Gallons: %5d, number of hours of labor: %.1f, Paint Cost: %.2f, the Labor Charge: $%.2f, Total Paint Cost: $%.2f" % (
Gallons, number_of_hours, paintCost, the_Labor_Charge, totalCost))

# getting choice from user

choice = input('Would you like to do another estimate(y/n)? ')

# if the choice is yes the program will do another estimate

if choice.upper() == 'Y':

pass

# if the choice is no or anything then program will terminate

elif choice.upper() == 'N' or choice.upper() != 'N':

break


if __name__ == "__main__":
main()

----

when the user puts in a negative number or 0 for the square ft of wall space and price of paint it advises them to use another value but when they use a decimal number such as "9.99" it crashes.

I need to make to where it takes all kinds of inputs including decimal numbers and advise them to try another value if they put in 0 or a negative number. if someone could also help me tidy up how it spits the end result it would be great

In: Computer Science

ASSEMBLY LANGUAGE PROGRAMMING Q:Write a complete assembly program that inputs a small signed integer n, whose...

ASSEMBLY LANGUAGE PROGRAMMING

Q:Write a complete assembly program that inputs a small signed integer n, whose value can fit within 8 bits, and outputs the value of the expression n2n + 6.

In: Computer Science

Write the c++ program of Secant Method and Fixed point Method in a one program using...

Write the c++ program of Secant Method and Fixed point Method in a one program using switch condition .Like :

cout<<"1.Secant Method \n 2. Fixed point Method\n"<<endl; if press 1 then work Secant Method if press 2 then work Fixed point Method .so please writhe the code in c++ using switch case.and the equation given down consider the equation in the given.Note: Must showt the all the step of output all the iteration step shown in the program .in program must shown all the step of iteration result

for secant method equation :4x3-2x-6=0

for fixed point=x2-x-1=0

Please in every itaration must be shown the output then finally Got the root

In: Computer Science

Write a program that checks whether or not a date entered in by the user is...

Write a program that checks whether or not a date entered in by the user is valid. Display the date and say if it is valid. If it is not valid explain why.

  • The input may be in the format mm/dd/yyyy, m/d/yyyy, mm/d/yyyy, or m/dd/yyyy.
  • A valid month (mm) must be from 1 to 12
  • A valid day (dd) must be from 1 to the appropriate number of days in the month
    • April, June, September, and November have 30 days
    • February has 28 except for leap years, then it has 29
    • The rest have 31 days
    • Leap years are years that are divisible by 4 BUT not divisible by 100 unless it is also divisible by 400

I don't need the coding. Just help with the questions 1 and 2.

  1. Include a flow chart in your proposed solution section
  2. Write the equivalent Boolean expression !(a>b)&&!(b==c) which doesn’t use the NOT operator (!). Assume that a, b, and c are integers.

In: Computer Science

Using the idea of the Bubble Sort algorithm, design an algorithm in pseudocode that gets 3...

Using the idea of the Bubble Sort algorithm, design an algorithm in pseudocode that gets 3 numbers a, b, c, from the user, and prints the 3 numbers in ascending order

In: Computer Science

In each of the projects that follow, you should write a program that contains an introductory...

In each of the projects that follow, you should write a program that contains an introductory docstring. This documentation should describe what the program will do (analysis) and how it will do it (design the program in the form of a pseudocode algorithm). Include suitable prompts for all inputs, and label all outputs appropri- ately. After you have coded a program, be sure to test it with a reasonable set of legitimate inputs.

5 An object’s momentum is its mass multiplied by its velocity. Write a pro- gram that accepts an object’s mass (in kilograms) and velocity (in meters per second) as inputs and then outputs its momentum.

6 The kinetic energy of a moving object is given by the formula KE=(1/2)mv2, where m is the object’s mass and v is its velocity. Modify the program you created in Project 5 so that it prints the object’s kinetic energy as well as its momentum.

Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles. Use the following approximations:

- A kilometer represents 1/10,000 of the distance between the North Pole and the equator.

- There are 90 degrees, containing 60 minutes of arc each, between the North Pole and the equator.

- A nautical mile is 1 minute of an arc.

*please use IDLE( python 3.7)

In: Computer Science

Please convert decimal value -32760 into 2's complement binary value

Please convert decimal value -32760 into 2's complement binary value

In: Computer Science

Part 2: Insertion Sort Q3. Arrange the following arrays in ascending order using Insertion sort. Show...

Part 2: Insertion Sort

Q3. Arrange the following arrays in ascending order using Insertion sort. Show all steps.

7          11        2          9          5          14

Q4. State the number of comparisons for each pass.

Pass

# comparisons

1st

2nd

3rd

4th

5th

In: Computer Science

convert 0x41BA8000 to IEEE-754 floating-point value

convert 0x41BA8000 to IEEE-754 floating-point value

In: Computer Science

Using Java: Implement print2D(A) so that it prints out its 2D array argument A in the...

Using Java:

  1. Implement print2D(A) so that it prints out its 2D array argument A in the matrix form.

  2. Implement add2Ds(A,B) so that it creates and returns a new 2D array C such that C=A+B.

  3. Implement multiScalar2D(c,A) so that it creates and returns a new 2D array B such that

    B=c×A.

  4. Implement transpose2D(A), which creates and returns a new 2D array B such that B is

    the transpose of A.

Your output should look like the following:A=

1234 5678 9 10 11 12

B=

2468 10 12 14 16 18 20 22 24

A+B=

3 6 9 12 15 18 21 24 27 30 33 36

5XA=

51015 20 25 30 35 40 45 50 55 60

Transpose of A =

159 2 6 10 3 7 11 4 8 12

Note that your methods should work for 2D arrays of any sizes.

In: Computer Science

convert 0x41BA8000 to IEEE-754 floating-point value

convert 0x41BA8000 to IEEE-754 floating-point value

In: Computer Science

Complete the code that inserts elements into a list. The list should always be in an...

Complete the code that inserts elements into a list. The list should always be in an ordered state.

#include <stdio.h>
#include <stdlib.h>

/* list of nodes, each with a single integer */
struct element {
struct element *next;
int value;
};

/* protypes for functions defined after main */
struct element *elementalloc(void);
struct element *listinitialize();
struct element *insertelement(struct element *, int);
void printlist(struct element *);

/* main
* Creates an ordered list
* Elements added to the list must be inserted maintaining the list
* in an ordered state
*/
int main() {
struct element *listhead = NULL;
listhead = listinitialize();
for (int i = 3; i < 100; i+=11){
listhead = insertnewelement(listhead, i);
}
printlist(listhead);
}

/* allocate memory for a new list element */
struct element *elementalloc(void) {
return (struct element *)malloc(sizeof(struct element));
}

/* simple list initialization function */
struct element *listinitialize() {
const int numbers[7] = {4, 9, 13, 18, 27, 49, 60};
struct element *newlist = NULL;
struct element *tail = NULL;
struct element *temp = NULL;
for (int i = 0; i < 7; i++) {
if (newlist == NULL) {
newlist = elementalloc();
newlist->next = NULL;
newlist->value = numbers[i];
tail = newlist;
} else {
temp = elementalloc();
temp->value = numbers[i];
temp->next = NULL;
tail->next = temp;
tail = tail->next;
}
}
return newlist;
}

/* function to insert elements into an ordered list */
struct element *insertnewelement(struct element *listhead, int x) {
struct element *newelement;
newelement = elementalloc();

struct element *iter = listhead;
while( ) {

}

return listhead;
}

/* print the list and the respective memory locations in list order */
void printlist(struct element *listhead)
{
while (listhead != NULL) {
printf("Memory: %p contains value: %d\n", listhead, listhead->value);
listhead = listhead->next;
}
}

In: Computer Science

How do I change my if statements into while and for loops, so that I can...

How do I change my if statements into while and for loops, so that I can make my bot go straight and turn exactly 12 times.

/***********************************************************************
* Exp7_1_RotaryEncoder -- RedBot Experiment 7_1
*
* Knowing where your robot is can be very important. The RedBot supports
* the use of an encoder to track the number of revolutions each wheels has
* made, so you can tell not only how far each wheel has traveled but how
* fast the wheels are turning.
*
* This sketch was written by SparkFun Electronics, with lots of help from
* the Arduino community. This code is completely free for any use.
*
* 8 Oct 2013 M. Hord
* Revised, 31 Oct 2014 B. Huang
***********************************************************************/

#include <RedBot.h>
RedBotMotors motors;

RedBotEncoder encoder = RedBotEncoder(3,9); // initializes encoder on pins A2 and 10
int buttonPin = 12;
int countsPerRev = 192; // 4 pairs of N-S x 48:1 gearbox = 192 ticks per wheel rev

// variables used to store the left and right encoder counts.
int lCount;
int rCount;

void setup()
{
pinMode(buttonPin, INPUT_PULLUP);
Serial.begin(9600);
Serial.println("left right");
Serial.println("================");
}

void turn()

{

long lCount = 0;

long rCount = 0;

long targetCount;

float numRev;

motors.leftMotor(-80);

motors.rightMotor(0);
// variables for tracking the left and right encoder counts

long prevlCount, prevrCount;

long lDiff, rDiff; // diff between current encoder count and previous count

encoder.clearEnc(BOTH); // clear the encoder count

delay(100); // short delay before starting the motors.

while (lCount < 0)

{

// while the right encoder is less than the target count – debug print

// the encoder values and wait – this is a holding loop.

lCount = encoder.getTicks(LEFT);

rCount = encoder.getTicks(RIGHT);

Serial.print(lCount);

Serial.print("\t");

Serial.print(rCount);

Serial.print("\t");

Serial.println(targetCount);

// calculate the rotation “speed” as a difference in the count from previous cycle.

lDiff = (lCount - prevlCount);

rDiff = (rCount - prevrCount);

// store the current count as the “previous” count for the next cycle.

prevlCount = lCount;

prevrCount = rCount;

}

delay(500); // short delay to give motors a chance to respond.
motors.brake();

}


void loop(void)
{
  
// wait for a button press to start driving.

  
if(digitalRead(buttonPin) == LOW)
{
encoder.clearEnc(BOTH); // Reset the counters.
delay(500);
motors.drive(180); // Start driving forward.
}
  

// store the encoder counts to a variable.
lCount = encoder.getTicks(LEFT); // read the left motor encoder
rCount = encoder.getTicks(RIGHT); // read the right motor encoder

// print out to Serial Monitor the left and right encoder counts.
Serial.print(lCount);
Serial.print("\t");
Serial.println(rCount);

// if either left or right motor are more than 5 revolutions, stop
  
if ((lCount >= 5*countsPerRev) || (rCount >= 5*countsPerRev ))
{
  
turn();
encoder.clearEnc(BOTH);
//motors.brake();
delay(500);
motors.drive(180); // Start driving forward.
  
  
}
  
}

In: Computer Science

convert 0x41BA8000 to IEEE-754 floating-point value

convert 0x41BA8000 to IEEE-754 floating-point value

In: Computer Science

Write a JavaFX application that presents a button and a circle. Every time the button is...

Write a JavaFX application that presents a button and a circle. Every time the button is pushed, the circle should be moved to a new random location within the window.

This must only be one .java file. I cannot use

import javafx.geometry.Insets;

import javafx.scene.canvas.Canvas;

import javafx.scene.canvas.GraphicsContext;

import javafx.scene.layout.HBox;

This is what I have so far:

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class CircleJumper extends Application
{
public double circlePositionX = 300;
public double circlePositionY = 300;
  
@Override
   public void start(Stage primaryStage)
{
Circle circle = new Circle(circlePositionX, circlePositionY, 70);
circle.setFill(Color.BLUE);

//create button to create new circle
Button push = new Button("PRESS!");
push.setOnAction(this::processButtonPress);
  
  
Group root = new Group(circle, push);
Scene Scene = new Scene(root, 700, 500, Color.WHITE);
  
       primaryStage.setTitle("Circle Jumper"); // Set the stage title
       primaryStage.setScene(Scene); // Place the scene in the stage
       primaryStage.show(); // Display the stage
   }
  
public void processButtonPress(ActionEvent event)
{   
Circle circle = new Circle(Math.random(), Math.random(), 50);
circle.setFill(Color.BLUE);
Group root = new Group(circle);
Scene Scene = new Scene(root, 700, 500, Color.WHITE);
}
  
public static void main(String[] args)
{
launch(args);
}

In: Computer Science