Member Avatar

The following SQL query would return 1 record with a min(unit_cm): select id, name, category, min(unit_cm), unit_Cost, unit_price, unit_costPerc from ( SELECT a.id, b.name, e.name as 'category', (d.unit_price - d.unit_cost) as 'unit_cm', d.unit_cost, d.unit_price, ((d.unit_cost/d.unit_price)*100) as 'unit_costPerc' FROM menu_items a, item b, menu c, price d, categories e where a.item_id_fk = b.id and a.menu_id_fk = c.id and b.id = d.item_id_fk and e.id = b.categories_id_fk ) tbl I intend to get 3 records with a min(unit_cm). How can I achieve such a result?

Member Avatar
0
18
Member Avatar

Hi, I have a table `id - Product_Name - Price - image` Some value like : `1 - My Product A - 50 - mpa.jpg` `2 - My Product B - 10 - mpb.jpg` `3 - My Product A - 40 - mpc.jpg` `4 - My Product C - 20 - mpd.jpg` i need product image of unique product based on minimum value. i am useing this query `SELECT id, Product_Name, MIN(Price), image FROM table GROUP BY Product_Name` It is showing right min price but the it is wrong, that's why i am geting image wrong, please help me to …

Member Avatar
0
15
Member Avatar

Hi, How can i find the maximum/minimum of a data every 24 hours. My Python delimited txt file has over 2 days worth of data This is a snippet of how my txt file data look like: TimeStamp,Irradiance,AMB_Temp 21/7/2014 0:00,5.6,25.6 21/7/2014 0:01,4.6,24.6 21/7/2014 0:02,5.6,22.6 21/7/2014 0:03,4.7,25.6 21/7/2014 0:04,5.3,24.6 21/7/2014 0:05,5.2,25.6 . . . 22/7/2014 23.59,5.6,24.5 i know how to display it over 2 days but within 24 hours period this is the code for displaying the max/min value over 2 days: long_title = 'Irradiance, AMB_Temp vs Time Graph at {} \n Max Value: {:.2f} at {} \n Min Value: {:.2f} …

-1
27
Member Avatar

i need to find a min and amx of the table and so far i can do the min of row 1 but nothing after that -------------------------------------------------------------------- |Name | A | B | C | D | E | -------------------------------------------------------------------- | 1 | 1.0 | 2.0 | 3.0 | 4.0 | 5.0 | | 2 | 6.0 | 7.0 | 8.0 | 9.0 | 0.0 | | 3 | 1.1 | 2.2 | 3.3 | 0.1 | 0.3 | -------------------------------------------------------------------- def minimum(y,l): for y in l: if y == 1: i= 0 w=(l[i],l[i+1],l[i+2],l[i+3],l[i+4]) a= min(l[i],l[i+1],l[i+2],l[i+3],l[i+4]) eli f y == 2: …

Member Avatar
0
26
Member Avatar

I'm making a class dataset. In it, I'm trying to set the minimum max and the mean. In my given test, I am asking the user to input as many grades as they would like so what I did, for example in minimum is this.. class Dataset(object): def __init__(self, grade): self.grade=[] def min(self): try: if int(input)<= self.grade: return int(input) except: pass using this test, from Dataset import Dataset def main(): print('This is a program to compute the min, max, mean and') print('standard deviation for a set of numbers.\n') while True: xStr = input('Enter a number (<Enter> to quit): ') if …

Member Avatar
0
34
Member Avatar

I have a problem that includes finding the maximums and minimums of certain variables in sequence. I want to nest the max() and min() functions as follows. $variable5 = min(max(($variable1 - $variable0), 0), $variable3); The PHP manual says/suggests that this type of nesting is possible. However, the code doesn't run correctly. It only runs correctly when I split up the nesting as follows. $variable2 = max(($variable1 - $variable0), 0); $variable5 = min(variable2, $variable3); I have not been able to find any other examples of what I want to do. Does anyone have experience with this? Can you offer any suggestions? …

Member Avatar
0
14
Member Avatar

> hey guys, how to get min value in array 2D except value zero '0'and also key ? > i've try use min and array_filter function to solve it > can you help me?please Array ( [0] => Array ( [0] => 0 [1] => 6 [2] => 4 ) [1] => Array ( [0] => 6 [1] => 0 [2] => 2 ) [2] => Array ( [0] => 4 [1] => 2 [2] => 0 ) ) i want result like this: Array ( [1] => Array ( [2] => 2 ) )

Member Avatar
0
19
Member Avatar

Hello, I am trying to start implementing functions from a class into my Calculator just to get used to the idea of it. when I tried calling for my min max functions into my calculations function it is spitting out an error arguement of type "float" is not compatable with parameter of type "float". I have tried everything I could think of which is probably not much since i've only been doing programming for maybe 2-3 weeks XD. But want to thank you all in advance for the help. header file #pragma once class calc { private: int Size; float …

Member Avatar
0
50
Member Avatar

Hi I would like to write program that calculate the sum of all integers from a minimum number up to the maximum number.by using the following formula? sum = 1/2 * number of integer * (minimum numbers + maximum number) How can I do it?

Member Avatar
0
11
Member Avatar

Hey everyone need some help again with finding the min and max from a text file. its my college lab assignment. here is my code till now. #include <iostream> #include <fstream> using namespace std; int main() { ofstream fout; fout.open("Text.txt"); ifstream fin; fin.open("Lab6.txt"); float c; int count = 0; float sum = 0; float mean = 0; float min = 0; float max = 0; float range = 0; //<<<<<they al have to be float because the text file has float numbers>>>> while (fin >> c) { count++; sum += c; mean = sum / count; } cout << "Total …

Member Avatar
0
7
Member Avatar

I am trying to find the minimum number when the user enters any 5 numbers I am not sure why this code is not working, every time I run this function I always get 0. Can someone please tell me what is wrong! int i; int num1 = 5; int min; min = arraySize[0]; arraySize[num1]; cout<<"Enter values (press enter after inputting every number): "<<endl; for (i=0; i<5; i++) { cin >> arraySize[i]; } for(i=1; i<5; i++) { if(min > arraySize[i]) { min = arraySize[i]; } } cout << "Your mininum number is " << min << endl;

Member Avatar
0
6
Member Avatar

Good day to every one. First here is my code so far import java.io.*; public class Program2 { public static void main (String[]args) throws IOException{ BufferedReader bv = new BufferedReader (new InputStreamReader(System.in)); String a, b, c, x; Float d, e, f, g, h, i, j, k, l, m, ave; System.out.println("ENTER FIRSTNAME: "); a = bv.readLine(); System.out.println("ENTER LASTNAME: "); b = bv.readLine(); System.out.println("ENTER COURSE: "); c = bv.readLine(); System.out.println("------ GRADE -------"); System.out.println("SUBJECT1 : "); x = bv.readLine(); d = Float.parseFloat(x); System.out.println("SUBJECT2 : "); x = bv.readLine(); e = Float.parseFloat(x); System.out.println("SUBJECT3 : "); x = bv.readLine(); f = Float.parseFloat(x); System.out.println("SUBJECT4 : "); …

Member Avatar
0
6
Member Avatar

package maxmin; import javax.swing.JOptionPane; public class MaxMin { public static void main(String[] args) { final int Tnum = 5; int num[] = new int[Tnum]; for(int i=0; i<num.length; i++) { String numstring = JOptionPane.showInputDialog(null,"Please enter number: ","User Input", JOptionPane.QUESTION_MESSAGE); num[i] = Integer.parseInt(numstring); } int max = num[0]; for(int i=0; i<num.length; i++) { if(max<num[i]); max = num[i]; } int min = num[0]; for(int i=0; i<num.length; i++) { if (min>num[i]); min = num[i]; } String MaxMin = "The array are : "; for(int i=0; i<num.length; i++) { MaxMin = MaxMin + num[i] + " "; } MaxMin = MaxMin + "\nThe largest number …

Member Avatar
0
19
Member Avatar

I'm getting an error with this code. Both the findMax and findMin lines in main say "Invalid conversion from 'int' to 'int*'". What does it mean? #include <iostream> using namespace std; int findMax(int[],int); int findMin(int[],int); int main () { int max, min, x; findMax(max,x); findMin(min,x); return 0; } int findMax(int a[], int n) { cout << "How many numbers would you like to enter? "; cin >> n; int max; max=a[n]; for(int i=0; i<n; i++) { if(max>a[i]) max=a[i]; } return max; } int finMin(int a[], int n) { cout << "How many numbers would you like to enter? "; cin …

Member Avatar
0
5
Member Avatar

I have a confusion of how to put that max and min in main method so it would run. PS: there might be mistakes ***The goal is to create a method that enter any numbers by user and it suppose to show the Max and Min.*** **PLEASE HELP~! what is wrong with this?** public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("How many numbers will be entered?"); int num = scanner.nextInt(); double[] grades = new double[num]; for(int i = 0; i < grades.length; i++) { System.out.println("Enter an integer: "); grades[i] = scanner.nextDouble(); } } public static int …

Member Avatar
0
13
Member Avatar

I have the following input and my program is not running: 1 3 2 1 3 7 8 [CODE] #include<iostream> #include <cstdlib> using namespace std; int main() { int arr[7], min, i=0, j=0; for(int i=0; i<7; i++) { cout<<"Enter value at arr["<<i<<"]: "; cin>>arr[i]; } min = arr[j]; for(; i<7; i++) { if(arr[i] < min) { min = arr[i]; } if(arr[i] == min) { min = arr[j+1]; //set min to next value in the array i=j+1; //set i to value in the min + 1... program hangs here... } } cout<<endl<<min; cout<<endl<<endl; system("pause"); return 0; } [/CODE] I think my …

Member Avatar
0
8
Member Avatar

Hello people, I've got a 2-d array, the first row has a string in each position, the second has a number in each position returned by a function that run on the strings.I run the mutatedstring function, run the matchmutated and put the values into the array, offspring times. Then I need to find the minimum number, and return the corresponding string. Could I use the min function for one row? How do I do this? [CODE] string mutated_chooser(string origmutated,string orisentance int offspringnumber) int array [2][offspringnumber] for (int t=0; t=offspringnumber-1;t++){ string newmutated = mutatedstring(origmutated); newmutated = array [0][t]; int matchmutated …

Member Avatar
0
7
Member Avatar

hi i am new here and i registered because i couldn't find the answer in google search my problem is that i could not find max and min of two arrays and the average too [CODE]#include<iostream> using namespace std; int array1[]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int array2[]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int a; int print_menu() { int choice; cout<<"#----------------------------------\n"; cout<<"# Manipulation of arrays #\n"; cout<<"# #\n"; cout<<"# BY MAFD #\n"; cout<<"#----------------------------------\n"; cout<<"# 1. Read Array 1 #\n# 2. Read Array 2 #\n"; cout<<"# 3. Max_min_two_arrays #\n# 4. sum_two_arrays #\n"; cout<<"# …

Member Avatar
0
4
Member Avatar

Hey, I'm studying for a final exam and I came across an old question asking to give an algorithm that runs in [TEX]O(logn)[/TEX] and deletes an arbitrary element from an [TEX]n[/TEX] element [B]Min-Heap[/B] if given its index. I was thinking the right approach would be to use Hash table for direct access in [TEX]O(1)[/TEX] time and then delete the element in [TEX]O(logn)[/TEX] time and maintaining the heap property. I don't really know how to go about writing an algorithm that does this though, so any help would be really appreciated. Thanks

Member Avatar
0
12
Member Avatar

I'm trying to find max and min values from a text file which contains data in rows and columns. But I want to create a script which will skip the first couple of lines and calculate the max and min from there on. I am aware for the max and min functions in Python, but I'm not sure how to specify the range. I know I can do something like the following: [CODE] f = open('data.txt', 'r') # Open file data = f.readlines() # Read lines in the file for range(2,...): # Define the range. Is there a way to …

Member Avatar
0
10
Member Avatar

Hey guys, My lecturer told me that when I have solved a problem, I should always look for ways to improve it. I was wondering if it is okay to post my code here and ask the community to comment and tell me if it can be improved, but I don't want to be told how. Hints are welcome though. Problem: Find the minimum and maximum of each column and row of a 2D array. I have spent about 1 hour so far and it works. This problem did confuse me with all the min's and max's. I was thinking …

Member Avatar
0
8
Member Avatar

Hi! I'm trying to find min variance (both value [U]and[/U] index). I have x# of product defects tracked over y# of days. prod1 prod2 prod3... Day1: 1 1 1 Day2: 1 2 2 I have arrays that store max & min defects, by product#. minVar = maxDefect[]-minDefect[] gives me the min [U]value[/U]. But try as I might, I can't figure out how to deterine the index #. minVar is the value. minVarProd is supposed to be the index. The output needs to read: The product with a minimum variance of _x_ is product _y_. I can get the x but …

Member Avatar
0
3

The End.