Aggiornato Prodotti

This commit is contained in:
Giacomo R. 2023-04-10 14:18:38 +02:00
parent ad40fa3b6c
commit 76b1f794a4
15 changed files with 235 additions and 90 deletions

View File

@ -0,0 +1 @@
{"diagram":"ClassDiagram","nodes":[{"methods":"+ applicaSconto()\n+ toString() : String","name":"NonAlimentari","x":540,"y":440,"attributes":"- materialePrincipale : String","id":2,"type":"ClassNode"},{"methods":"+ getCodiceBarre() : int\n+ getDescrizione() : String\n+ getPrezzo() : double\n+ applicaSconto()\n+ toString() : String\n+ equals(o : Object) : boolean\n+ hashCode() : int\n# setPrezzo(nuovoPrezzo : double)","name":"Prodotti","x":370,"y":120,"attributes":"- codiceBarre : int\n- descrizione : String\n- prezzo : double","id":0,"type":"ClassNode"},{"methods":"+ applicaSconto()\n+ toString() : String\n# setDate(oggi : DataFormattata)","name":"Alimentari","x":290,"y":430,"attributes":"- scadenza : DataNumerica","id":1,"type":"ClassNode"}],"edges":[{"Generalization Type":"Inheritance","start":2,"end":0,"type":"GeneralizationEdge"},{"Generalization Type":"Inheritance","start":1,"end":0,"type":"GeneralizationEdge"}],"version":"3.5"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -119,7 +119,43 @@ is divided into following sections:
<property name="module.name" value=""/> <property name="module.name" value=""/>
</target> </target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property,-init-modules-supported" name="-do-init"> <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property,-init-modules-supported" name="-do-init">
<property name="platform.java" value="${java.home}/bin/java"/> <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
<j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
<j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
<j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
<condition property="platform.javac" value="${platform.home}/bin/javac">
<equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
</condition>
<property name="platform.javac" value="${platform.javac.tmp}"/>
<j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
<condition property="platform.java" value="${platform.home}/bin/java">
<equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
</condition>
<property name="platform.java" value="${platform.java.tmp}"/>
<j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
<condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
<equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
</condition>
<property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
<condition property="platform.invalid" value="true">
<or>
<contains string="${platform.javac}" substring="$${platforms."/>
<contains string="${platform.java}" substring="$${platforms."/>
<contains string="${platform.javadoc}" substring="$${platforms."/>
</or>
</condition>
<fail unless="platform.home">Must set platform.home</fail>
<fail unless="platform.bootcp">Must set platform.bootcp</fail>
<fail unless="platform.java">Must set platform.java</fail>
<fail unless="platform.javac">Must set platform.javac</fail>
<fail if="platform.invalid">
The J2SE Platform is not correctly set up.
Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files.
Either open the project in the IDE and setup the Platform with the same name or add it manually.
For example like this:
ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used)
</fail>
<available file="${manifest.file}" property="manifest.available"/> <available file="${manifest.file}" property="manifest.available"/>
<condition property="splashscreen.available"> <condition property="splashscreen.available">
<and> <and>
@ -242,20 +278,6 @@ is divided into following sections:
<condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}">
<isset property="profile.available"/> <isset property="profile.available"/>
</condition> </condition>
<condition else="false" property="jdkBug6558476">
<and>
<matches pattern="1\.[56]" string="${java.specification.version}"/>
<not>
<os family="unix"/>
</not>
</and>
</condition>
<condition else="false" property="javac.fork">
<or>
<istrue value="${jdkBug6558476}"/>
<istrue value="${javac.external.vm}"/>
</or>
</condition>
<property name="jar.index" value="false"/> <property name="jar.index" value="false"/>
<property name="jar.index.metainf" value="${jar.index}"/> <property name="jar.index.metainf" value="${jar.index}"/>
<property name="copylibs.rebase" value="true"/> <property name="copylibs.rebase" value="true"/>
@ -343,7 +365,7 @@ is divided into following sections:
</path> </path>
</resourcecount> </resourcecount>
</condition> </condition>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<src> <src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false"> <dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/> <include name="*"/>
@ -394,7 +416,7 @@ is divided into following sections:
<property location="${build.dir}/empty" name="empty.dir"/> <property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/> <mkdir dir="${empty.dir}"/>
<mkdir dir="@{apgeneratedsrcdir}"/> <mkdir dir="@{apgeneratedsrcdir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<src> <src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false"> <dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/> <include name="*"/>
@ -436,7 +458,7 @@ is divided into following sections:
<sequential> <sequential>
<property location="${build.dir}/empty" name="empty.dir"/> <property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/> <mkdir dir="${empty.dir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<src> <src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false"> <dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/> <include name="*"/>
@ -515,7 +537,7 @@ is divided into following sections:
<element name="customizePrototype" optional="true"/> <element name="customizePrototype" optional="true"/>
<sequential> <sequential>
<property name="junit.forkmode" value="perTest"/> <property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
<syspropertyset> <syspropertyset>
<propertyref prefix="test-sys-prop."/> <propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/> <mapper from="test-sys-prop.*" to="*" type="glob"/>
@ -543,7 +565,7 @@ is divided into following sections:
<element name="customizePrototype" optional="true"/> <element name="customizePrototype" optional="true"/>
<sequential> <sequential>
<property name="junit.forkmode" value="perTest"/> <property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
<syspropertyset> <syspropertyset>
<propertyref prefix="test-sys-prop."/> <propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/> <mapper from="test-sys-prop.*" to="*" type="glob"/>
@ -619,7 +641,7 @@ is divided into following sections:
</fileset> </fileset>
</union> </union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EsPasqua" testname="TestNG tests" workingDir="${work.dir}"> <testng classfilesetref="test.set" failureProperty="tests.failed" jvm="${platform.java}" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EsPasqua" testname="TestNG tests" workingDir="${work.dir}">
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
<propertyset> <propertyset>
<propertyref prefix="test-sys-prop."/> <propertyref prefix="test-sys-prop."/>
@ -850,6 +872,9 @@ is divided into following sections:
<classpath> <classpath>
<path path="@{classpath}"/> <path path="@{classpath}"/>
</classpath> </classpath>
<bootclasspath>
<path path="${platform.bootcp}"/>
</bootclasspath>
</nbjpdastart> </nbjpdastart>
</sequential> </sequential>
</macrodef> </macrodef>
@ -899,7 +924,7 @@ is divided into following sections:
<attribute default="jvm" name="jvm"/> <attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/> <element name="customize" optional="true"/>
<sequential> <sequential>
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true" module="@{modulename}"> <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true" jvm="${platform.java}" module="@{modulename}">
<classpath> <classpath>
<path path="@{classpath}"/> <path path="@{classpath}"/>
</classpath> </classpath>
@ -933,7 +958,7 @@ is divided into following sections:
<attribute default="jvm" name="jvm"/> <attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/> <element name="customize" optional="true"/>
<sequential> <sequential>
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true"> <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true" jvm="${platform.java}">
<classpath> <classpath>
<path path="@{classpath}"/> <path path="@{classpath}"/>
</classpath> </classpath>
@ -965,7 +990,7 @@ is divided into following sections:
<attribute default="jvm" name="jvm"/> <attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/> <element name="customize" optional="true"/>
<sequential> <sequential>
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true"> <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true" jvm="${platform.java}">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
@ -1199,7 +1224,7 @@ is divided into following sections:
<j2seproject3:copylibs manifest="${tmp.manifest.file}"/> <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
<echo level="info">To run this application from the command line without Ant, try:</echo> <echo level="info">To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/> <property location="${dist.jar}" name="dist.jar.resolved"/>
<echo level="info">java -jar "${dist.jar.resolved}"</echo> <echo level="info">${platform.java} -jar "${dist.jar.resolved}"</echo>
</target> </target>
<target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-check-do-mkdist" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-check-do-mkdist" if="do.archive" name="-do-jar-jar" unless="do.mkdist">
<j2seproject1:jar manifest="${tmp.manifest.file}"/> <j2seproject1:jar manifest="${tmp.manifest.file}"/>
@ -1301,8 +1326,8 @@ is divided into following sections:
<isset property="main.class.available"/> <isset property="main.class.available"/>
</and> </and>
</condition> </condition>
<property name="platform.jlink" value="${jdk.home}/bin/jlink"/> <property name="platform.jlink" value="${platform.home}/bin/jlink"/>
<property name="jlink.systemmodules.internal" value="${jdk.home}/jmods"/> <property name="jlink.systemmodules.internal" value="${platform.home}/jmods"/>
<exec executable="${platform.jlink}"> <exec executable="${platform.jlink}">
<arg value="--module-path"/> <arg value="--module-path"/>
<arg path="${jlink.systemmodules.internal}:${run.modulepath}:${dist.jar}"/> <arg path="${jlink.systemmodules.internal}:${run.modulepath}:${dist.jar}"/>
@ -1495,16 +1520,19 @@ is divided into following sections:
</not> </not>
</and> </and>
</condition> </condition>
<exec executable="${platform.java}" failonerror="false" outputproperty="platform.version.output">
<arg value="-version"/>
</exec>
<condition else="" property="bug5101868workaround" value="*.java"> <condition else="" property="bug5101868workaround" value="*.java">
<matches pattern="1\.[56](\..*)?" string="${java.version}"/> <matches multiline="true" pattern="1\.[56](\..*)?" string="${platform.version.output}"/>
</condition> </condition>
<condition else="" property="javadoc.html5.cmd.line.arg" value="-html5"> <condition else="" property="javadoc.html5.cmd.line.arg" value="-html5">
<and> <and>
<isset property="javadoc.html5"/> <isset property="javadoc.html5"/>
<available file="${jdk.home}${file.separator}lib${file.separator}jrt-fs.jar"/> <available file="${platform.home}${file.separator}lib${file.separator}jrt-fs.jar"/>
</and> </and>
</condition> </condition>
<javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath> <classpath>
<path path="${javac.classpath}"/> <path path="${javac.classpath}"/>
</classpath> </classpath>

View File

@ -1,8 +1,8 @@
build.xml.data.CRC32=2fdcd13d build.xml.data.CRC32=24751a7c
build.xml.script.CRC32=7d6b168c build.xml.script.CRC32=7d6b168c
build.xml.stylesheet.CRC32=f85dc8f2@1.106.0.48 build.xml.stylesheet.CRC32=f85dc8f2@1.106.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=2fdcd13d nbproject/build-impl.xml.data.CRC32=24751a7c
nbproject/build-impl.xml.script.CRC32=fc1dc10f nbproject/build-impl.xml.script.CRC32=6509df98
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.106.0.48 nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.106.0.48

View File

@ -1,2 +1,8 @@
compile.on.save=true compile.on.save=true
user.properties.file=/home/giacomo/.netbeans/17/build.properties do.depend=false
do.jar=true
do.jlink=false
javac.debug=true
javadoc.preview=true
jlink.strip=false
user.properties.file=/home/gicorada/.netbeans/17/build.properties

View File

@ -3,10 +3,12 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<file>file:/home/giacomo/NetBeansProjects/Prodotti/src/prodotti/Alimentari.java</file> <file>file:/media/gicorada/Scuola/Anni%20Severi/22-23/Informatica/java-scuola/NetBeans%20Projects/Prodotti/src/prodotti/NonAlimentari.java</file>
<file>file:/home/giacomo/NetBeansProjects/Prodotti/src/prodotti/Prodotti.java</file> <file>file:/media/gicorada/Scuola/Anni%20Severi/22-23/Informatica/java-scuola/NetBeans%20Projects/Prodotti/src/prodotti/ListaSpesa.java</file>
<file>file:/home/giacomo/NetBeansProjects/Prodotti/src/prodotti/NonAlimentari.java</file> <file>file:/media/gicorada/Scuola/Anni%20Severi/22-23/Informatica/java-scuola/NetBeans%20Projects/Prodotti/src/prodotti/DataFormattata.java</file>
<file>file:/home/giacomo/NetBeansProjects/Prodotti/src/prodotti/ListaSpesa.java</file> <file>file:/media/gicorada/Scuola/Anni%20Severi/22-23/Informatica/java-scuola/NetBeans%20Projects/Prodotti/src/prodotti/Prodotti.java</file>
<file>file:/media/gicorada/Scuola/Anni%20Severi/22-23/Informatica/java-scuola/NetBeans%20Projects/Prodotti/src/prodotti/Alimentari.java</file>
<file>file:/media/gicorada/Scuola/Anni%20Severi/22-23/Informatica/java-scuola/NetBeans%20Projects/Prodotti/src/prodotti/DataNumerica.java</file>
</group> </group>
</open-files> </open-files>
</project-private> </project-private>

View File

@ -1,9 +1,10 @@
annotation.processing.enabled=true annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list= annotation.processing.processors.list=
annotation.processing.run.all.processors=true annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=EsPasqua
application.vendor=gicorada
build.classes.dir=${build.dir}/classes build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
@ -32,6 +33,7 @@ dist.jar=${dist.dir}/EsPasqua.jar
dist.javadoc.dir=${dist.dir}/javadoc dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/EsPasqua dist.jlink.output=${dist.jlink.dir}/EsPasqua
endorsed.classpath=
excludes= excludes=
includes=** includes=**
jar.compress=false jar.compress=false
@ -44,8 +46,8 @@ javac.modulepath=
javac.processormodulepath= javac.processormodulepath=
javac.processorpath=\ javac.processorpath=\
${javac.classpath} ${javac.classpath}
javac.source=11 javac.source=17
javac.target=11 javac.target=17
javac.test.classpath=\ javac.test.classpath=\
${javac.classpath}:\ ${javac.classpath}:\
${build.classes.dir} ${build.classes.dir}
@ -75,7 +77,7 @@ main.class=prodotti.ListaSpesa
manifest.file=manifest.mf manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false mkdist.disabled=false
platform.active=default_platform platform.active=Zulu_17.0.6_10
run.classpath=\ run.classpath=\
${javac.classpath}:\ ${javac.classpath}:\
${build.classes.dir} ${build.classes.dir}

View File

@ -4,6 +4,7 @@
<configuration> <configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3"> <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>EsPasqua</name> <name>EsPasqua</name>
<explicit-platform explicit-source-supported="true"/>
<source-roots> <source-roots>
<root id="src.dir"/> <root id="src.dir"/>
</source-roots> </source-roots>

View File

@ -1,30 +1,41 @@
package prodotti; package prodotti;
import java.util.Date;
/** /**
* * Classe che rappresenta Prodotti alimentari
* @author giacomo * @author radaelli11353
*/ */
public class Alimentari extends Prodotti { public class Alimentari extends Prodotti {
Date scadenza; private DataNumerica scadenza;
static DataNumerica oggi;
public Alimentari(int codiceBarre, String descrizione, double prezzo, Date scadenza) { public Alimentari(int codiceBarre, String descrizione, double prezzo, DataNumerica scadenza) {
super(codiceBarre, descrizione, prezzo); super(codiceBarre, descrizione, prezzo);
this.scadenza = scadenza; this.scadenza = scadenza;
} }
//Necessario per impostare data di oggi a tutti gli Alimentari
public Alimentari() {
super(0, "", 0);
}
/**
* Metodo che aggiorna la data del giorno attuale
* @param oggi Nuova data
*/
public void setDate(DataFormattata oggi) {
Alimentari.oggi = (DataNumerica) oggi;
}
@Override @Override
public void applicaSconto() { public void applicaSconto() {
//condizione da implementare int delta = scadenza.getDifference(oggi);
if(true) { if(delta > -10 && delta < 0) {
setPrezzo(getPrezzo() - getPrezzo()* 0.2); setPrezzo(getPrezzo() - getPrezzo()* 0.2);
} }
} }
@Override
public String toString() {
return "Alimentari[" + getDescrizione() + ", " + getPrezzo() + "€, scade il " + scadenza.stringaFormattata() + ", codice a barre " + getCodiceBarre() + "]";
}
} }

View File

@ -0,0 +1,41 @@
package prodotti;
/**
* Classe che rappresenta una data senza fornire metodi per la formattazione
* @author radaelli11353
*/
public abstract class DataFormattata implements Comparable<DataFormattata> {
private int giorno;
private int mese;
private int anno;
public DataFormattata(int giorno, int mese, int anno) {
if(giorno >= 1 && giorno <= 31) this.giorno = giorno;
else throw new IllegalArgumentException("Il numero del giorno non è valido");
if(mese >= 1 && mese <= 12) this.mese = mese;
else throw new IllegalArgumentException("Il numero del mese non è valido");
this.anno = anno;
}
protected int getGiorno() {
return giorno;
}
protected int getMese() {
return mese;
}
protected int getAnno() {
return anno;
}
@Override
public int compareTo(DataFormattata o) {
if(this.anno != o.anno) return this.anno - o.anno;
if(this.mese != o.mese) return this.mese - o.mese;
return this.giorno - o.giorno;
}
public abstract String stringaFormattata();
}

View File

@ -0,0 +1,39 @@
package prodotti;
/**
* Classe che rappresenta una data numerica
* @author radaelli11353
*/
public class DataNumerica extends DataFormattata {
public DataNumerica(int giorno, int mese, int anno) {
super(giorno, mese, anno);
}
@Override
public String stringaFormattata() {
int g = getGiorno();
int m = getMese();
int a = getAnno();
String res = (g<10) ? "0"+g : ""+g;
res += "/";
res += (m<10) ? "0"+m : "" + m;
return res + "/" + a;
}
/**
* Restituisce i giorni di differenza tra le due date
* @param o Altra data
* @return Differenza tra i giorni, Integer.MIN_VALUE se mese o anno diverso (per il problema del numero variabile di giorni al mese
*/
public int getDifference(DataNumerica o) {
//Provvisorio, per il problema del numero di giorni variabile.
//Non dovrebbe influire con l'esecuzione richesta da Alimentari, altrimenti andrebbe riscritto
if(getAnno() != o.getAnno() || getMese() != o.getMese()) return Integer.MIN_VALUE;
return compareTo(o);
}
}

View File

@ -2,35 +2,49 @@ package prodotti;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Scanner; import java.util.Scanner;
import java.util.Date;
/** /**
* * Classe di test per Prodotti
* @author giacomo * @author radaelli11353
*/ */
public class ListaSpesa { public class ListaSpesa {
public static void main(String[] args) { public static void main(String[] args) {
ArrayList<Prodotti> listaSpesa = new ArrayList<>(); ArrayList<Prodotti> listaSpesa = new ArrayList<>();
Scanner in = new Scanner(System.in); Scanner in = new Scanner(System.in);
System.out.println("Hai la tessera fedeltà?"); //Metodo provvisorio per sistemare la data in tutti gli Alimentari
boolean tessera = (in.next().equalsIgnoreCase()) ? true : false; DataNumerica oggi = new DataNumerica(12, 2, 2023);
Alimentari a = new Alimentari();
a.setDate(oggi);
System.out.println("Inserisci il numero di prodotti");
System.out.print("Hai la tessera fedeltà? (S/n) ");
boolean tessera = in.next().equalsIgnoreCase("s");
System.out.print("Inserisci il numero di prodotti: ");
int n = in.nextInt(); int n = in.nextInt();
for(int i = 0; i < n; i++) { for(int i = 0; i < n; i++) {
String tipoProdotto = in.next().toLowerCase(); System.out.print("Alimentari (a) o non alimentari (n)? (a/n) ");
if(tipoProdotto.equals("alimentari")) { char tipoProdotto = in.next().toLowerCase().charAt(0);
System.out.println("Inserisci i dati del prodotto nel formato:\nCodiceBarre\ndescrizione\nprezzo\nscadenza"); if(tipoProdotto == 'a') {
listaSpesa.add(new Alimentari(in.nextInt(), in.nextLine(), in.nextDouble(), new Date())); //System.out.println("Inserisci i dati del prodotto nel formato:\nCodiceBarre\ndescrizione\nprezzo\nscadenza");
listaSpesa.add(new Alimentari(1234, "Prova alimentare", 10.00, new DataNumerica(10, 2, 2023)));
} else if(tipoProdotto == 'n') {
//System.out.println("Inserisci i dati del prodotto nel formato:\nCodiceBarre\ndescrizione\nprezzo\nmateriale principale");
listaSpesa.add(new NonAlimentari(4321, "Prova non alimentare", 100.00, "vetro"));
} }
} }
double prezzo; double prezzo = 0;
System.out.println("Elementi nella lista:");
for(Prodotti p : listaSpesa) { for(Prodotti p : listaSpesa) {
if(tessera) p.applicaSconto();
prezzo += p.getPrezzo(); prezzo += p.getPrezzo();
System.out.println(p);
} }
System.out.println("\n--- Prezzo finale: " + prezzo + "€ ---");
} }
} }

View File

@ -1,8 +1,8 @@
package prodotti; package prodotti;
/** /**
* * Classe che rappresenta Prodotti non alimentari
* @author giacomo * @author radaelli11353
*/ */
public class NonAlimentari extends Prodotti { public class NonAlimentari extends Prodotti {
String materiale; String materiale;
@ -18,5 +18,12 @@ public class NonAlimentari extends Prodotti {
setPrezzo(getPrezzo() - getPrezzo()* 0.1); setPrezzo(getPrezzo() - getPrezzo()* 0.1);
} }
} }
@Override
public String toString() {
return "NonAlimentari[" + getDescrizione() + ", " + getPrezzo() + "€, fatto di " + materiale + ", codice a barre " + getCodiceBarre() + "]";
}
} }

View File

@ -2,14 +2,13 @@ package prodotti;
import java.util.Objects; import java.util.Objects;
/** /**
* Class Prodotti * Classe che rappresenta Prodotti generici
* @author radaelli11353
*/ */
public class Prodotti { public class Prodotti {
private int codiceBarre; private final int codiceBarre;
private String descrizione; private final String descrizione;
private double prezzo; private double prezzo;
public Prodotti(int codiceBarre, String descrizione, double prezzo) { public Prodotti(int codiceBarre, String descrizione, double prezzo) {
@ -19,29 +18,33 @@ public class Prodotti {
} }
/** /**
* Get the value of codiceBarre * Ritorna il valore di codiceBarre
* @return the value of codiceBarre * @return valore di codiceBarre
*/ */
public int getCodiceBarre () { public int getCodiceBarre () {
return codiceBarre; return codiceBarre;
} }
/** /**
* Get the value of descrizione * Ritorna la descrizione
* @return the value of descrizione * @return descrizione
*/ */
public String getDescrizione () { public String getDescrizione () {
return descrizione; return descrizione;
} }
/** /**
* Get the value of prezzo * Ritorna il prezzo
* @return the value of prezzo * @return prezzo
*/ */
public double getPrezzo () { public double getPrezzo () {
return prezzo; return prezzo;
} }
/**
* Modifica il prezzo
* @param nuovoPrezzo Prezzo nuovo
*/
protected void setPrezzo(double nuovoPrezzo) { protected void setPrezzo(double nuovoPrezzo) {
prezzo = nuovoPrezzo; prezzo = nuovoPrezzo;
} }
@ -53,21 +56,11 @@ public class Prodotti {
prezzo = prezzo - prezzo * 0.05; prezzo = prezzo - prezzo * 0.05;
} }
/**
*
* @return String
*/
@Override @Override
public String toString() { public String toString() {
return "Prodotto[descrizione: " + descrizione + ", prezzo:" + prezzo + ", codice a barre:" + codiceBarre; return "Prodotto[" + descrizione + ", prezzo:" + prezzo + ", codice a barre:" + codiceBarre + "]";
} }
/**
* @param o
* @return boolean
*/
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if(o == null) return false; if(o == null) return false;